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

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

WBOY
Release: 2023-09-05 22:57:08
forward
602 people have browsed it

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
}
Copy after login

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!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template