ABSTRACT

Often, we encounter a situation where we use a set of data rather than a single datum. For instance, if you want to know the Cumulative Grade Point Average (CGPA) of a class, you must store the CGPA of all students belonging to that class. For that, we need a different data type because a simple variable can hold only one datum. The C language provides a derived data type known as an array to store multiple data of the same data type. This chapter introduces the concept of an array and its type. Mainly three important array concepts are discussed in this chapter: one-dimensional (1D) arrays, two-dimensional (2D) arrays, and strings. 1D and 2D arrays refer to collections of either integers or real numbers stored in a contiguous memory location, referred to by a single name. A string is one form of a 1D array but stores only characters. The C language provides several predefined string functions to manipulate strings, and this chapter also includes discussions of these functions.