My Subject Blog

C Program to Access Array using Pointer

/*
Write a program using a pointer to read an array of integer and print elements in reverse order.
*/

#include <stdio.h>

int main(void) 
{
int a[10],*p,i;
p=a;
for(i=0;i<10;i++)
{
printf("Enter Value for [%d] Position : ",i+1);
scanf("%d",(p+i));
}
for(i--;i>=0;i--)
{
printf("\n a[%d] = %d",i+1,*(p+i));
}
return 0;
}

Comments

Most Visited Post

C Program to Find Largest Odd Number from Array

Followers