CS 1325 Lecture 8:
Document Summary
Collection of elements of the same data type. All the elements are stored in contiguous memory locations. Each element can be accessed randomly using a subscript (index) Data_type could be a primitive data type or adt(user defined) Array name: follows the same rules as any other variable(i. e. cannot start. Size: an integer value(it has to be a constant: literal, named or. Size tells how much memory has to be reserved for the array. The elements can be accessed through the index value. In c, the first valid index value is 0: the ith element will have an index i-1. The index has to be an integer (or integer expression) i. e. c[2] = 4; int i=6; c[ i ]=12; The memory reserved for an array: int x[10]; int uses 4 bytes the array reserved spaced for 10 integers the size of x is 4*10= 40 bytes.