Array C Programing


An array created at compile time by specifying size in the source code has a fixed size and cannot be modified at run time. The process of allocating memory at compile time is known as static memory allocation and the arrays that receives static memory allocation are called static arrays.

This approach works fine as long as we know exactly what our data requirements are. Suppose we don't know what are our data requirements in that case we can use dynamic arrays.

In C, it is possible to allocate memory to arrays at run time. This feature is known as dynamic memory allocation and the arrays created at run time are called dynamic arrays. Dynamic arraysare created using pointer variables and memory management functions malloc, calloc and realloc.