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.
3 Respuestas
+ 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
+ 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
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?