<<< The Multics project | Index | C/C++ memory access, cont. >>> |
Our previous example needs an important modification to compile properly using today's C/C++ compiler:
int MEMORY = 0; // start at the beginning of memory int location = 248; // set location of memory cell #248 MEMORY[ (char*) location ] = 65; // save character A in memory char x = MEMORY[ (char*) location ]; // assign value from memory to character x
The expression
(char*) location
tells the compiler that we are accessing a specific data type -- a char in our example.
<<< The Multics project | Index | C/C++ memory access, cont. >>> |