Array in C programming


                 Array


Array is the collection of same data type.Array indices start at zero in C, and go to one less than the size of the array.  For example, a five element array will have indices zero through four.  This is because the index in C is actually an offset from the beginning of the array.  ( The first element is at the beginning of the array, and hence has zero offset. )

An array is a special type of variable used to store multiple values of same data type at a time.


There are 2 types of C arrays. They are,

  • One dimensional array.
  • Multi dimensional array. Two dimensional array. Three dimensional array. four dimensional array etc…

Some texts refer to one-dimensional arrays as vectors, two-dimensional arrays as matrices, and use the general term arrays when the number of dimensions is unspecified or unimportant.


The index value in an array is also called as subscript.


Pair of one sub- script is one dimensional array. Pair of two sub-script os two dimensional etc.



Single Dimensional Array


In c programming language, single dimensional arrays are used to store list of values of same datatype. In other words, single dimensional arrays are used to store a row of values. In single dimensional array, data is stored in linear form.

Multi Dimensional Array


An array of arrays is called as multi dimensional array. In simple words, an array created with more than one dimension (size) is called as multi dimensional array. Multi dimensional array can be of two dimensional array or three dimensional array or four dimensional array or more...

Most popular and commonly used multi dimensional array is two dimensional array. The 2-D arrays are used to store data in the form of table. 


Note:
  • Array might be belonging to any of the data types
  • Array size must be a constant value.
  • Always, Contiguous (adjacent) memory locations are used to store array elements in memory.
  • It is a best practice to initialize an array to zero or null while declaring, if we don’t assign any values to array.





         ðŸ‘‰   The roots of education are bitter 
                        but the fruit is sweet 👈


                           Thank you 😊😊

Comments

Popular posts from this blog

Introduction of C Language

Constant in C

Computer generation