C File =>
/* Write a program to display elements of an array using pointer. */
#include<stdio.h>
int main() {
int num[30],n,i,sum;
//declaring pointer to array
int (*p)[30]=#
printf("\n Enter how many elements :");
scanf("%d",&n);
printf("\n Accepting data :\n");
for(i=0;i<n;i++)
{
printf("\n Enter number%d:",i+1);
scanf("%d",&num[i]);
}
printf("\n Array elements are:\n");
//displaying array elements using pointer
for(i=0;i<n;i++)
printf("%d\t",(*p)[i]);
return 0;
}
Comments
Post a Comment
Please do not enter any spam link in message.