To Create an array in C


Levels of difficulty: / perform operation:

C program to create an array. Print the values and addresses of each elements of the array.

C Program

#include <stdio.h>
#include <conio.h>
void main()
{
	int a[5];
	int i,n=5;
	clrscr();
	for(i=0;i<n;i++)
	{
		printf("\nENTER THE NUMBER-%d: ",i+1);
		scanf("%d",&a[i]);
	}
	for(i=0;i<n;i++)
        printf("ARRAY ELEMENT-%d: VALUE=%d, ADDRESS=%u\n",i+1,a[i],&a[i]);
	getch();
}


Output