Varanasi-Software-Junction / datastructures

A repository on Data Structures
MIT License
8 stars 5 forks source link

Arrays #19

Open vidishaverma89 opened 1 year ago

vidishaverma89 commented 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]);

}