Learn C++ in step-by-step lessons.
Arrays
If you declare 3 variables as num1, num2, and num3, 3 separate locations in memory are allocated. These are called scalar variables.

Instead you could declare num to be an array with a size of 3. The elements of an array are indexed, starting with 0. You would refer to these values as num[0], num[1], and num[3].
The index can be a variable.
For example if i=2, then num[i] would be the same as num[2]. This makes it easy to use loops to process the array.

Goals:
- Be able to declare and use an array
Objectives:
- Declare and use an array in a program;
- Trace execution of a program that uses arrays;
- Read a file into an array.
Please study the material at each of the links below.
- Input 3 numbers
- Input and Arrange
- Names of Months
- Find the day of the year
- Fast Food menu
- Read a file into an array
- Employee program project
- Project flow charts
- Project starting code
Glossary for arrays lesson
Full Glossary