+ 2

what is dereferencing ?

17th Sep 2016, 1:43 PM
prateek nandwana
2 Respostas
+ 3
To access the value pointed by a pointer, you have to dereference it first with *. int foo = 42; int* p = &foo; cout << *p << endl; //Here we dereference p and print the value pointed, 42.
17th Sep 2016, 2:16 PM
Zen
Zen - avatar
+ 1
prateek nandwana, I think DEFERENCE means simply asterisk ( star ) (*) applying to variable. ( Creating a POINTER variable. ) For example., int sad; // is a variable. /* If i apply the asterisk to variable; that is "sad" it means i DEFERENCE the "sad" variable. In other words i create a pointer variable. */ *sad = NULL; // THIS IS A DEREFERENCING. I Hope you will understand.🙏👍✔️
16th Apr 2021, 3:57 PM
SARVESH ASHOK DEVRUKHAKAR
SARVESH ASHOK DEVRUKHAKAR - avatar