arry in c program
C Programming Arrays
An array is a collection of a fixed number of values of a single type. For example: if you want to store 100 integers in sequence, you can create an array for it.
int data[100];
The size and type of arrays cannot be changed after its declaration.
Arrays are of two types:
- One-dimensional arrays
- Multidimensional arrays (will be discussed in next chapter)
How to declare arrays :
data_type array_name[array_size];
program code :
#include<stdio.h>
int main()
{
int n,i;
int num[100];
printf(" declared array of elements size : ");
scanf("%d",&n);
printf("Ente the arry elements number : ");
for(i=0; i<n; i++)
{
scanf("%d",&num[i]);
printf("%d ",num[i]);
}
return 0;
}
output :
program code:
#include<stdio.h>
int main()
{
int nu[6];
int i,j;
printf("Ente the arry elements number : ");
for(i=0;i<6;i++){
scanf("%d",&nu[i]);
}
for(j=0;j<6;j++){
printf("%d ",nu[j]);
}
return 0;
}
output :
program code :

No comments