1.
1 #include <stdio.h>
2 #include <conio.h>
3
4 void main() {
5 int stack[5], i;
6 int *top;
7 top = stack;
8 clrscr();
9 printf("Enter the elements in the stack:\n");
10
11 for (i = 0; i < 5; i++) {
12 scanf("%d", top++);
13 }
14
15 printf("The address associated with those elements are:\n");
16 for (i = 0; i < 5; i++) {
17 printf("%d is at %u\n", *--top, top);
18 }
19
20 getch();
21 }
22
23
OUTPUT
Enter the elements in the stack: 1 2 3 4 5
The address associated with those elements are:
5 is at 6422292
4 is at 6422288
3 is at 6422284
2 is at 6422280
1 is at 6422276