Actions

EmSys

C - Pointers2

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 ...

  • The unary operator * is the indirection or de-referencing operator.
  • When applied to a pointer, it accesses the contents, the pointer points to.
int x = 1;
int y = 2;
int* ip;	// ip is a pointer to int
ip = &x;	// ip now points to x
y = *ip;	// y is now 1
*ip = 0;	// x is now 0