C LAB‎ > ‎(Sem1) Introduction to C‎ > ‎

WAP to understand pointers.

posted Nov 10, 2010, 10:03 AM by Neil Mathew   [ updated Nov 10, 2010, 10:05 AM ]


SOURCE CODE:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
 
main()
{
int a,*p;
     
printf("Enter an integer: ");     
scanf("%d",&a);
     
p = &a;
     
printf("\nAddress of a: %u", &a);
printf("\n\nAddress of p: %u", &p);
printf("\n\nValue of p: %d", p);
printf("\n\nValue of a: %d", a);
printf("\n\nValue of a: %d", *p);
}
 

OUTPUT:

Enter an integer: 7

Address of a: 3219592736

Address of p: 3219592732

Value of p: -1075374560

Value of a: 7

Value of a: 7
Comments