Open vidishaverma89 opened 1 year ago
array is a collection of items of the same type stored in contiguous memory locations.
defining arrays: int a[]={1,2,3}; int b[10]; int c[3]={9,0,8}; int d[10]={0,9}; int e[3]={9,8,7,6,5};//Error
finding length of an array: input : int n=sizeof(d)/sizeof(int); printf("%d",n);
output : 10
for printing the numbers : for(int i=0;i<=n-1;i++) { printf("%d,",a[i]);
}
array is a collection of items of the same type stored in contiguous memory locations.
defining arrays:
int a[]={1,2,3}; int b[10]; int c[3]={9,0,8}; int d[10]={0,9}; int e[3]={9,8,7,6,5};//Error
finding length of an array: input : int n=sizeof(d)/sizeof(int); printf("%d",n);
output : 10
for printing the numbers : for(int i=0;i<=n-1;i++) { printf("%d,",a[i]);