traverse the array in C by R4R Team

-This page is for beginners in the array.

Array:
Array is the collection of different values having same data type.
-We have a integer Array that having all integer values.
-Character array is known as String.

-Here we Try to Traverse(print) the Array

program-

#include < stdio.h>
int main()
{
int arr[100]; //array
int n,i;
printf("Enter number of element you want in array\n");
scanf("%d",&n);
printf("Enter elements in array\n");
// input of n elements in array
for(i=0;i< n;i++)
{
scanf("%d",&arr[i]);
}
//Now traverse
printf("Your array is \n");
for(i=0;i< n;i++)
printf("%d,",arr[i]);
return 0;
}


output-

Enter number of element you want in array
5
Enter elements in array
3 45 67 12 90
Your array is
3 45 67 12 90




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!