please can someone explain pointer further | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

please can someone explain pointer further

for example what does int ***p stands for?

12th Nov 2016, 9:43 PM
damilare lamidi
damilare lamidi - avatar
2 Answers
+ 3
int *p1 points to an integer variable. int **p2 can points to p1 int ***p3 can points to p2 example: int a=5; int *p1 = &a; int **p2 = &p1; int ***p3 = &p2; Note that pointer stores memory address. If you look that this way, it is not complicated. p3 stores the address of p2, ...., p1 stores the address of variable 'a'. p2 points to a pointer that point to 'a'. You should imagine memory as a grid, and the pointer as an arrow. The begin of the arrow is a square, and the end of the arrow is also a square. For instance, the beginning of p1 is a square which is the end of p2. The end of p1 is the variable 'a'. To change the value of the variable 'a' with p3, you should go through p2 and p1. ***p = 6;
12th Nov 2016, 10:31 PM
Marcell Juhasz
+ 1
thanks alot. well explained
12th Nov 2016, 10:36 PM
damilare lamidi
damilare lamidi - avatar