Pointer & variable address in C.

 

01  #include<stdio.h>
02
03 int main()
04 {
05 int a=10; //integer variable
06
07 int *ptr; //integer pointer
08
09 ptr= &a; // ptr points to 'a'
10
11 printf("Value of A : %d n",a);
12 printf("Address of A : %u nnn",&a);
13
14
15 printf("*PTR points to : %d n",*ptr);
16 printf("Address store in PTR : %u n",ptr);
17
18 /*
19 a and *ptr are same
20
21 &a and ptr are same
22 */
23
24 return 0;
25 }
 
 
OUTPUT :

Value of A : 10
Address of A : 8688


*PTR points to : 10
Address store in PTR : 8688
 
 

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.