Program to illustrate One Dimensional Array with address array and data
#include <stdio.h>
#define max 22
int main()
{
int a[max],i,n;
printf("\n Enter the size of an array : ");
scanf("%d",&n);
for(i = 0; i < n; i++)
{
scanf("%d",&a[i]);
}
printf("\n Array elements are : ");
for(i = 0; i < n; i++)
{
printf("\n Address : %p --> Array : a[%d] --> Data : %d ",&a[i],i,a[i]);
}
}
Output:
#include <stdio.h>
#define max 22
int main()
{
int a[max],i,n;
printf("\n Enter the size of an array : ");
scanf("%d",&n);
for(i = 0; i < n; i++)
{
scanf("%d",&a[i]);
}
printf("\n Array elements are : ");
for(i = 0; i < n; i++)
{
printf("\n Address : %p --> Array : a[%d] --> Data : %d ",&a[i],i,a[i]);
}
}
Output:
No comments:
Post a Comment