27.2.08

Variable length Arrays/Dynamic Arrays

C99 added the feature called dynamic arrays in C.

Means we can specify the length of the array in the run time.

But there is one limitation that once the length of the array specified,

it’s not possible to change the length of array again.


Code fragment.

int length;

int arr[length];

Printf(“Enter the Length of the array \n”);

Scanf (“%d”, &length);



NOTE: Here the length of the arr is length and it should not be changed.