Write a program to print the elements of array in reverse order.

C Programming Language Pointer in C Language (Article) Pointer in C Language (Program)

828

Program:

#include <stdio.h>
int main(void)
{
	int a[] = {10, 12, 6, 7, 2};
	int i, *p;
	p=a+4;
	for(i=0; i<5; i++)
		printf("%d\n", p[-i]);
	return 0;
}


Output:

2
7
6
12
10


Explanation:

None

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.