What does de-referenced mean?![]()
This is a discussion on What does de-referenced mean? within the C++ Programming forums, part of the General Programming Boards category; What does de-referenced mean?...
What does de-referenced mean?![]()
Derefencing the pointer (ptr) gives access to the value of the variable that the pointer is pointing at. If the line was:Code:int num = 100; int* ptr = # cout << *ptr << endl;
then I would just be printing the value of the pointer, ie an address.Code:cout << ptr << endl;
Dereferenced means "give the contents of the address pointed to". So if
int *p = &i;
Then
cout<< p <<"\n"; // Prints the address of i
cout<< *p <<"\n"; // Prints the value of i
-Prelude
My best code is written with the delete key.