Monday, January 23, 2012

C pointer

Pointers are created by the indirect operator (*). The syntax is type *variable For example, int *p is a pointer to an integer If A is the memory location of pointer p and B is the memory location of the integer p points to, *p = 123 => store the value in location B P = 123 => store the value in location A. In other words, change p to point to another memory location The & operator returns the address of the variable. For example, p = &n makes p points to n

No comments: