0

What is the difference between * as a symbol of pointer and * as a dereference while using both in a same code?

this is a C++ question.

4th Sep 2018, 3:18 AM
Maitrey Bhaskar
Maitrey Bhaskar - avatar
3 Réponses
+ 1
Maitrey Bhaskar refer below and feel free to ask for query : int c = 9; int *p = &c; // here, * indicates that p is pointer pointing to int cout << *p ;// here, value of variable pointed by pointer is required... * is dereferencing operator... if * is not used, alone p will display memory address of pointer
4th Sep 2018, 5:09 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
this is same code only...in one code block, both are used...what do you mean by same code.. single statement ?? if so, you can't have I guess... if you put two **, it represents pointer to pointer and double ** as dereferencing means value of pointer to pointer
4th Sep 2018, 2:01 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
this mean that when only pointer is used , then cout<< *p << endl; represent *p as pointer. But what will be the code when pointer and dereference is used in the same code?
4th Sep 2018, 1:43 PM
Maitrey Bhaskar
Maitrey Bhaskar - avatar