C Array Limitations

Limitations of Array in C Programming :

We know What is an array in C Programming. Array is very useful which stores multiple data under single name with same data type. Following are some listed limitations of Array in C Programming.

A. Static Data

  1. Array is Static data Structure
  2. Memory Allocated during Compile time.
  3. Once Memory is allocated at Compile Time it Cannot be Changed during Run-time

Limitations of Array in C Programming

B. Can hold data belonging to same Data types

  1. Elements belonging to different data types cannot be stored in array because array data structure can hold data belonging to same data type.
  2. Example : Character and Integer values can be stored inside separate array but cannot be stored in single array

C. Inserting data in Array is Difficult

  1. Inserting element is very difficult because before inserting element in an array we have to create empty space by shifting other elements one position ahead.
  2. This operation is faster if the array size is smaller, but same operation will be more and more time consuming and non-efficient in case of array with large size.

D. Deletion Operation is difficult

  1. Deletion is not easy because the elements are stored in contiguous memory location.
  2. Like insertion operation , we have to delete element from the array and after deletion empty space will be created and thus we need to fill the space by moving elements up in the array.

E. Bound Checking

  1. If we specify the size of array as ‘N’ then we can access elements upto ‘N-1′ but in C if we try to access elements after ‘N-1′ i.e Nth element or N+1th element then we does not get any error message.
  2. Process of Checking the extreme limit of array is called Bound Checking and C does not perform Bound Checking.
  3. If the array range exceeds then we will get garbage value as result.

F. Shortage of Memory

  1. Array is Static data structure. Memory can be allocated at compile time only Thus if after executing program we need more space for storing additional information then we cannot allocate additional space at run time.
  2. Shortage of Memory , if we don’t know the size of memory in advance

G. Wastage of Memory

  1. Wastage of Memory , if array of large size is defined

Here are more some recommended readings on limitations on array.