Array Declaration in c :





Array declaration in C is the process of defining an array, specifying its data type and size.



What is declaration of one dimensional array in c?

In C, the declaration of an array involves specifying the data type of its elements and its name as well as we can assign the size for an array.

The syntax of array declaration in c :

data_type array_name[array_size];

Where:
  • data_type: Specifies the type of data that the array will hold (e.g., int, float, char, etc.).
  • array_name: The identifier used to refer to the array.
  • array_size: The number of elements that the array will contain. This can be a constant value or an expression that evaluates to an integer.


Array declaration example

 
    int intArray[5]; // Integer array
    char charArray[5]; // Character array
    float floatArray[5];  // Float array
    double doubleArray[5];  // Double array
    long longArray[5];  // Long array
    short shortArray[5];  // Short array
    unsigned int unsignedIntArray[5]; // Unsigned Integer array
    unsigned long unsignedLongArray[5];// Unsigned Long array
    unsigned short unsignedShortArray[5]; // Unsigned Short array
    int boolArray[2];// Boolean array (not native to C, using int to represent)