C program to read and display an array using pointer

C program to read and display an array using pointer

#include<stdio.h>
#include<conio.h>

void main()
{
int a[50],*p,i,n;
clrscr();
p=a;
printf(“Enter size of array:”);
scanf(“%d”,&n);
printf(“Enter elements of array:”);

for(i=0;i<n;++i)
scanf(“%d”,p+i);

for(i=0;i<n;++i)
printf(“%d “,*(p+i));
getch();
}

3 thoughts on “C program to read and display an array using pointer”

Leave a Comment

Your email address will not be published. Required fields are marked *