//How to declare array and show values of an array
#include<stdio.h>
#include<conio.h>
void main() {
int arr[5],i;
clrscr();
arr[0]=1;
arr[1]=2;
arr[2]=3;
arr[3]=4;
arr[4]=5;
printf("Value of array is:\n");
for(i=0;i<5;i++)
{
printf("%d\n",arr[i]);
}
getch();
}
Output:
Value of array is:1
2
3
4
5
No comments:
Post a Comment