Array in C
- Array is a linear collection of similar elements.
- Array is also known as a subscript variable.
- Array is a group of variables.
Where can we use the Array?
Here we have to evaluate the average of 1000 values. So, we have to declare 1000 variables minimum to complete this program. Instead of declaring 1000 separate variables, we use an array.
EX: a  where a  an array and 1000 is the no of variables.
It is a group, but it has no individual name, but it has index numbers just like 0, 1, and 2, and it takes contiguous memory in RAM. Index no. is also called Position no. It has the same type of data element, just like either int, or char, or float.
Array actually represents the index of the first variable in an Array.
If we want to access each variable, we write
a  [At first the name of the array, then square bracket and index no.]
But at first, when we declare an array, that means total no. of variables in an array,
int a  [It means a is an array, where 10 variables exist]
But after that, when we write just like,
a, a…. it means index no. of the array
Here we show how an array is declared. With the help of an array, we calculate the average of some values.
Here we declare an array named a, which holds 10 values. With the help of for loop, we add some values which will be taken from the user using the scanf () function. Then we calculate the average of this sum of ten values and store it in the avg variable.
Declaration of Array
Int a ; error [Whenever we declare an array without initialisation and do not put any number between the bracket, it means error occurred here]
Whenever we declare an array without initialization, it means each index has, by default garbage value existing there.
When we declare an array with initialization, then we are allowed to empty the square bracket.
If we initialize an array with less number, the rest of the values in the index of the array are, by default, zero.
Here we show how a dynamic array works on the data, and with the help of the array, we evaluate the minimum and maximum value from a group of numbers.
Here with the help of the malloc () function, we declare an array and get some values on runtime time to calculate minimum and maximum values from those values. We declare two variables named min and max and print those variables.
With the help of the array index, we reverse the values of the array here.
Here we create an array with the help of dynamic memory allocation. Malloc () function creates the block of the array and dynamically gets some values. Then we reverse these values of the arrays and print them.
Here we show how the elements of an array are copied to another array.
Here we declared an array named a . In this array, we take some values from the user. Now we declared another array named b . The elements of array b  are copied from the elements of the array a  and print those values both array a and b. We can see the same output is generated as they are copied versions.
Here we discuss in detail the basic concept of an array. An array is a procedure to store values in the memory. Through array, we can access any element quickly. But array has some limitations regarding its usefulness but is very useful in the programming perspective.