Write a C program to print the elements of an array in reverse order using pointer.
C Program:
#include<stdio.h>
int main() {
int n, i;
int *p;
printf("\nEnter the size of array : ");
scanf("%d", &n);
int arr[n];
p=&arr[0];
printf("\nEnter %d integers: ",n);
for (i=0;i<n;i++) {
scanf("%d",p);
p++;
}
p=&arr[n-1];
printf("\nReverse of the array is :");
for (i=n-1;i>=0;i--) {
printf("\n%d",*p);
p--;
}
}
if you like the answer please provide a thumbs up.
Get Answers For Free
Most questions answered within 1 hours.