Although Peter answered your question, one thing that’s clearly confusing you is the symbols * and &. The tough part about getting your head around these is that they both have two different meanings that have to do with indirection (even excluding the third meanings of * for multiplication and & for bitwise-and).
-
*, when used as part of a type
indicates that the type is a pointer:
intis a type, soint*is a
pointer-to-int type, andint**is a
pointer-to-pointer-to-int type. -
&when used as part of a type indicates that the type is a reference.intis a type, soint&is a reference-to-int (there is no such thing as reference-to-reference). References and pointers are used for similar things, but they are quite different and not interchangable. A reference is best thought of as an alias, or alternate name, for an existing variable. Ifxis anint, then you can simply assignint& y = xto create a new nameyforx. Afterwords,xandycan be used interchangeably to refer to the same integer. The two main implications of this are that references cannot be NULL (since there must be an original variable to reference), and that you don’t need to use any special operator to get at the original value (because it’s just an alternate name, not a pointer). References can also not be reassigned. -
*when used as a unary operator performs an operation called dereference (which has nothing to do with reference types!). This operation is only meaningful on pointers. When you dereference a pointer, you get back what it points to. So, ifpis a pointer-to-int,*pis theintbeing pointed to. -
&when used as a unary operator performs an operation called address-of. That’s pretty self-explanatory; ifxis a variable, then&xis the address ofx. The address of a variable can be assigned to a pointer to the type of that variable. So, ifxis anint, then&xcan be assigned to a pointer of typeint*, and that pointer will point tox. E.g. if you assignint* p = &x, then*pcan be used to retrieve the value ofx.
So remember, the type suffix & is for references, and has nothing to do with the unary operatory &, which has to do with getting addresses for use with pointers. The two uses are completely unrelated. And * as a type suffix declares a pointer, while * as a unary operator performs an action on pointers.