$\require{cancel}$
int x; float pi{3.14}; char word[10];
// not initialized, definitely don't do. int * iPtr; // a pointer to an int, or an array of ints. BodyPartT * parts; // a pointer to a BodyPartT or an arry of them; FooT * fooPtr;
nullptr
0, NULL
and nullptr
NULL
is from c, probably a defined constant.
nullptr
is the modern, accepted version.
int * iPtr = nullptr; // a pointer to an int, or an array of ints. BodyPartT * parts{nullptr}; // a pointer to a BodyPartT or an arry of them; FooT * fooPtr{nullptr};
0, NULL
or nullptr
&identifier
returns a pointer to that variable.
*ptr
dereferences or follows the pointer.
0, NULL
or nullptr
// this is not real, but ... assume T ary[n]; T operator [] (T * base_address; size_t index) { return T + size_of(*T) * index }
type * & parameter
const int * ptr
makes a pointer to a constant int.
int const * ptr
int * const ptr
makes the pointer constant.