What is an array?

In C++, an array is a collection of the same type of values. It is generally a comma-separated range of values enclosed in curly brackets { } and stored as a single variable. For example, {10, 20, 30} is an array of integers. It can be stored as a variable as shown in the code below:

Get hands-on with 1200+ tech skills courses.