Professional Documents
Culture Documents
5 - Arrays
5 - Arrays
By Neeru Redhu
CCS HAU
Derived data type
12345
56.981
A
Arrays
Data structures
Related data items of same type
Remain same size once created
Fixed-length entries
ARRAY - MEMORY LAYOUT
The definition:
int tests[5];
allocates the following memory:
Examples:
int tests[5] is an array of 20 bytes, assuming 4 bytes for
an int
long double measures[10]is an array of 80 bytes,
assuming 8 bytes for a long double
SIZE DECLARATORS
Named constants are commonly used as size
declarators.
x[3] = x[1] * 6;
Declaration of One-Dimensional Arrays
DataType variable-name [size];
float height[50];