Default
Google

Variables: Arrays

Applies To: C++Builder 1 or higher
Category: C++ Language

Arrays are collections of data storage locations which have the same data type and the same name. You can declare variable arrays of any data type using the following form:
 
type_name variable_name[size];
 
For example int x[50]; will create 50 array elements (the first one is 0 and the last one 49). You can also add second brackets creating a multidimensional array:
 
int x[50][10];
 
To initialize an array, use the = operator with a list of values enclosed in braces:
 
int x[3] = {1, 2, 3};
 
To change the value of the second array element use:
 
x[1] = 35;

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange