<<< Memory access syntax -- Assembly | Index | DEC PDP-7 Computer >>> |
Because C is a system programming language, it must provide direct access to physical hardware, including memory.
C supports Assembly language style to access memory. For example,
int MEMORY = 0; // start at the beginning of memory int location = 248; // set location of memory cell #248 MEMORY[ location ] = 65; // save 65 in memory int x = MEMORY[ location ]; // assign value from memory to x
The above C code uses square brackets to access memory cell #248, counting from the beginning of memory.
This code would compile just fine on PDP-7.
<<< Memory access syntax -- Assembly | Index | DEC PDP-7 Computer >>> |