Engineering Science 1036A/B Lecture Notes - Lecture 7: Null Pointer, Compile Time, Ampersand
Document Summary
In general, it contains the address of an existing variable. A pointer variable is declared with asterisk (*) sign followed by the name of the variable int *ptr; The asterisk is known as the pointer operator. If an already declared pointer variable uses the * sign in front of it, the * sign is called a indirection or dereferencing operator. There are two general forms of declaring a pointer: Before using any pointer variable, it has to be initialized: With the address of existing variable (which has been declared) using address of (&) operator (aka reference operator) With the address of another existing pointer variable. Assigning null or 0 to a pointer indicates that it is not pointing anywhere. C++ only checks the contents of a pointer if it is != 0. The address-of operator & in front of any variable produces the address of that variable.