Explain array with example

Explain  Array syntax


Array

Group of consecutive memory locations
Same name and type
To refer to an element, specify
Array name
Position number
Format:
arrayname[ position number ]
First element at position 0
n element array named c:
c[ 0 ], c[ 1 ]...c[ n – 1 ]

Array elements are like normal variables
    c[ 0 ] =  3;
    printf( "%d", c[ 0 ] );

Perform operations in subscript.  If  x equals 3
    c[ 5 - 2 ] == c[ 3 ] == c[ x ]

Labels: