pointer basics

Solutions on MaxInterview for pointer basics by the best coders in the world

showing results for - "pointer basics"
Juan Esteban
12 Feb 2018
1#include <stdio.h>
2
3int main () {
4
5   int  var = 20;   /* actual variable declaration */
6   int  *ip;        /* pointer variable declaration */
7
8   ip = &var;  /* store address of var in pointer variable*/
9
10   printf("Address of var variable: %x\n", &var  );
11
12   /* address stored in pointer variable */
13   printf("Address stored in ip variable: %x\n", ip );
14
15   /* access the value using the pointer */
16   printf("Value of *ip variable: %d\n", *ip );
17
18   return 0;
19}