-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadvanced_pointers_double_pointer_ex_2.c
43 lines (31 loc) · 1.48 KB
/
advanced_pointers_double_pointer_ex_2.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdio.h>
int main()
{
int num=123;
//A normal pointer singlePointer
int *singlePointer = NULL;
//This pointer doublePointer is a double pointer
int **doublePointer = NULL;
//Assigning the address of variable num to the single pointer
singlePointer = #
//Assigning the address of pointer singlePointer to the doublePointer
doublePointer = &singlePointer;
/* Possible ways to find value of variable num*/
printf("\n Value of num is: %d", num);
printf("\n Value of num using singlePointer is: %d", *singlePointer);
printf("\n Value of num using doublePointer is: %d", **doublePointer);
/*Possible ways to find address of num*/
printf("\n Address of num is: %p", &num);
printf("\n Address of num using singlePointer is: %p", singlePointer);
printf("\n Address of num using doublePointer is: %p", *doublePointer);
/*Find value of pointer*/
printf("\n Value of Pointer singlePointer is: %p", singlePointer);
printf("\n Value of Pointer singlePointer using doublePointer is: %p", *doublePointer);
/*Ways to find address of pointer*/
printf("\n Address of Pointer singlePointer is:%p",&singlePointer);
printf("\n Address of Pointer singlePointer using doublePointer is:%p",doublePointer);
/*Double pointer value and address*/
printf("\n Value of Pointer doublePointer is:%p",doublePointer);
printf("\n Address of Pointer doublePointer is:%p",&doublePointer);
return 0;
}