C++ is a statically typed, compiled, general-purpose, case-sensitive, irregular programming language that supports procedural programming, object-oriented programming and generic programming.

C++ is considered a mid-level language that combines the features of high-level and low-level languages.

C++ was designed and developed by Bjarne Stroustrup in 1979 at Bell Laboratories in Murray Hill, New Jersey. C++ further extended and improved the C language, originally named C with classes and later renamed C++ in 1983.

C++ is a superset of C. In fact, any legal C program is a legal C++ program.

C++ array syntax

C++ supports array data structures, which can store a fixed-size sequential collection of elements of the same type. An array is used to store a series of data, but it is often thought of as a series of variables of the same type.

The declaration of an array is not to declare individual variables, such as number0, number1,..., number99, but to declare an array variable, such as numbers, and then use numbers[0], numbers[1 ],..., numbers[99] to represent individual variables. Specific elements in an array can be accessed via index.

All arrays are composed of contiguous memory locations. The lowest address corresponds to the first element, and the highest address corresponds to the last element.

C++ array example

#include <iostream>
using namespace std;
#include <iomanip>
using std::setw;
int main (){
int n[ 10 ]; // n is an array containing 10 integers
​
// Initialize array elements
for ( int i = 0; i < 10; i++ )
{
n[i] = i + 100; //Set element i to i + 100
}
cout << "Element" << setw( 13 ) << "Value" << endl;
// Output the value of each element in the array
for ( int j = 0; j < 10; j++ )
{
cout << setw( 7 )<< j << setw( 13 ) << n[ j ] << endl; }
​
Return 0;}