From Valve Developer Community
Revision as of 04:41, 17 July 2005 by TheJ89 (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Pointers are special in C++. Pointers can be used to point to a variable instead of becoming a variable.

Here is an example:

There are 5 integer variables.

Each one is named accordingly (anInteger1, anInteger2, ect)

However we have a function that uses whatever integer the user chooses.

Enter pointers.

When running the program, the user makes his choice to pick whatever integer he wants.

When that happens, the pointer is pointed twoard that integer.

Finally, whenever the user is ready, he will continue to the next stage, where a function is run to return the value of the integer he has chosen.

The function will automatically pick whatever integer we have the pointer aimed at.