| <<< C/C++ memory access demo v.3 | Index | The B programming language >>> |
#include <iostream>
using namespace std;
int main()
{
char* location = "HELLO";
// If offset is zero, we can access memory by
cout << location[ 0 ] << "\n";
// The following does the same thing:
cout << *location << "\n";
return 0;
}
Obtaining something from a memory location at the specified address is called dereference
Expression *location uses dereference operator (or indirection operator)
| <<< C/C++ memory access demo v.3 | Index | The B programming language >>> |