Arrays is a very interesting concept in c programming as it allow to store multiple values in a variable
now i will wirte a program to demonstrate a program to show how arrays works
#include<stdio.h>
int main()
{
int array[3]; // array declaration
array[0] = 5; //array initilisation of 1st element
array[1] = 6;
array[2] = 7;
printf("%d",array[0]);
return 0;
}
The above program demonstrate use of array like every variable which has a data type arrays also have a data type which decide the kind of value that we can store in a array also when we declare a array we have to specify how many elements we want to store in a array, one important think to note is that array element start from 0 , so in a array of n element we can store (n - 1) elements
now i will wirte a program to demonstrate a program to show how arrays works
#include<stdio.h>
int main()
{
int array[3]; // array declaration
array[0] = 5; //array initilisation of 1st element
array[1] = 6;
array[2] = 7;
printf("%d",array[0]);
return 0;
}
The above program demonstrate use of array like every variable which has a data type arrays also have a data type which decide the kind of value that we can store in a array also when we declare a array we have to specify how many elements we want to store in a array, one important think to note is that array element start from 0 , so in a array of n element we can store (n - 1) elements
0 comments:
Post a Comment