Professional Documents
Culture Documents
Pointers and Arrays
Pointers and Arrays
What is a pointer
Pointers
A pointer is a variable that contains the address of a variable. They are
commonly used in C because they are sometimes the only way to express a
computation and partly because they usually lead to more compact and
efficient code than can be obtained any other way
Pointers and Addresses
MEMORY
CHAR
BYTE
SHORT INT
2 BYTES
LONG INT
4 BYTES
Pointers and Addresses
Pointers and Addresses
int x = 1, y =2, z[10];
y = *ip; /* y is now 1 */
*ip = 0; /* x is now 0 */