C Programming Tutorial
Computer Tutorial

Declaration of an Array

Declaration of an Array

Like other variables an array needs to be declared so that the compiler will know what kind of an array and how large an array we want.

The general form for declaring a array is :

variable type         name of array [size of array];

int marks[5] ;

» The int specifies the type of the array.
» The wordmarks specifies the name of the array variable.
» The number [5] tells how many elements of the type int will be in our array. This number is often called the ‘dimension’ of the array.
» The bracket ( [ ] ) tells the compiler that we are dealing with an array.