Declare an Array in C

-Declare an Array
-Syntax of an Array
-How to initialize an Array

Arrays

Arrays are used to store multiple values in a single variable, instead of declaring separate variables for each value.

To create an array, define the data type (like int) and specify the name of the array followed by square brackets [].

We can declare an array in the c language in the following way.

data_type  array_name [array_size];

To insert values to it, use a comma-separated list, inside curly braces:

Integer Data Type Array Declaration and Initialization:

int myNumbers[4] = { 255075100 };


Float Data Type Array Declaration and Initialization:


float myNumbers[4]  =  { 25.50,  50.20,  75.00,  100.60 } ;


Char Data Type Array Declaration and Initialization:


char myChar[4] = { 'c',  'h',   '$',  '*'  } ;

Comments