Arrays:
int a=10;
a=2;
printf("%d",a); // if you try to print this you will get 2 as out put.
As we know variable can hold only one value at a time. but in few situations we need to store multiple in a single variable.
Arrays: is a variable that hold multiple elements which has same data type. or Array is a collects of variables of same type.
declaration of an array in C:
data_type array_name[size of the array];
ex: int a[5];
This statements tells that you want to store 5 integer values in array 'a'.
No comments:
Post a Comment