Actions

EmSys

C - Pointers

From EdWiki

Revision as of 09:30, 23 June 2015 by Jshankar (Talk | contribs) (1 revision imported: EdWiki -- Emsys pages from Shukra)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Pointers

A pointer is a variable that contains the address of an another variable.

int* ip;	// ip is a pointer to int
char* cp;	// cp is a pointer to char

The unary operator & gives the address of a variable.

char ch;
cp = &ch;

assigns the address of ch to the variable cp, and cp is said to “point to” ch.