Home  >  Article  >  Backend Development  >  What does "dereferencing" a pointer mean in C/C++?

What does "dereferencing" a pointer mean in C/C++?

WBOY
WBOYforward
2023-09-05 22:57:08571browse

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

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

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, the address in p is basically the address of the variable.

The above is the detailed content of What does "dereferencing" a pointer mean in C/C++?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete

Related articles

See more