Tutorial by Examples

C++11 Note: in all the following, the existence of the C++11 constant nullptr is assumed. For earlier versions, replace nullptr with NULL, the constant that used to play a similar role. Creating a pointer variable A pointer variable can be created using the specific * syntax, e.g. int *pointer_...
There are two operators for pointers: Address-of operator (&): Returns the memory address of its operand. Contents-of (Dereference) operator(*): Returns the value of the variable located at the address specified by its operator. int var = 20; int *ptr; ptr = &var; cout << var &...
Increment / Decrement A pointer can be incremented or decremented (prefix and postfix). Incrementing a pointer advances the pointer value to the element in the array one element past the currently pointed to element. Decrementing a pointer moves it to the previous element in the array. Pointer ari...

Page 1 of 1