Main PDF Lesson 2
Main PDF Lesson 2
Main PDF Lesson 2
ARRAYS
LESSON #1
Single Dimensional
Array
Upon completion of this subtopic, you will be able to:
• Create single dimensional arrays.
• Understand how single array holds value
• An array is a series of elements of the same type placed
in contiguous memory locations that can be individually
referenced by adding an index to a unique identifier.
• An array is used to store a collection of data, but it is
often more useful to think of an array as a collection of
variables of the same type.
• To declare an array in C++, the programmer specifies the
type of the elements and the number of elements required
by an array as follows:
type arrayName [ arraySize ];
balance[0] = 100;
In the given statement, we access the first index of array balance and
then assign a value of 100.
Output:
Suppose you declared an array of 10 elements. Let's say,
int testArray[10];
int x[3][4];