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];
Here:
  • 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

Array Declaration For All Data-Types
Type Declaration
Integer Array
int intArray[5];
Character Array
char charArray[5];
Float Array
float floatArray[5];
Double Array
double doubleArray[5];
Long Array
long longArray[5];
Short Array
short shortArray[5];
Unsigned Integer Array
unsigned int unsignedIntArray[5];
Unsigned Long Array
unsigned long unsignedLongArray[5];
Unsigned Short Array
unsigned short unsignedShortArray[5];
Boolean Array (Using int)
int boolArray[2];