Array of integers

If we have a small number of elements, let us say we want 3 variables, then we can declare them separately like var1, var2, and var3. But if we have a large number of variables then we can use arrays to store them.

Figure: Array of integers
Image arrint

You can declare an array of any data type (i.e. int, float, double, char) in C. The following ways can be used to declare and initialize an array in C. Array can be of type: char, int, long int, double. In fact any type declaration can be in the form of an array.

Figure: Stores square numbers in array
Image modarr