What does “dereferencing” a pointer mean in C/C++?

CC++Server Side ProgrammingProgramming

Dereferencing is used to access or manipulate data contained in memory location pointed to by a pointer. *(asterisk) is used with pointer variable when dereferencing the pointer variable, it refers to variable being pointed, so this is called dereferencing of pointers.

int main() {
   int a = 7, b ;
   int *p; // Un-initialized Pointer
   p = &a; // Stores address of a in ptr
   b = *p; // Put Value at ptr in b
}

Here, address in p is basically address of a variable.

raja
Published on 03-Apr-2019 11:15:35
Advertisements