Write a program to implement array using pointers in c
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10], i, n;
clrscr();
printf("How many elements? ");
scanf("%d",&n);
printf("Enter the elements:\n");
for(i=0;i<n;i++)
scanf("%d",(a+i));
printf("The entered elements are\n");
for(i=0;i<n;i++)
printf("%d\n",*(a+i));
getch();
}
Output:
How many elements? 3
Enter the elements:
1
2
3
The entered elements are
1
2
No comments: