Note: assigned ......
★Similarities:
● All are addresses;
The Pointer Points to a piece of memory. Its content refers to the memory address, and the reference is the alias of a piece of memory.
★Differences:
● A pointer is an entity, and a reference is only an alias;
● The reference can only be initialized once during definition, but cannot be changed afterwards; the pointer can be changed; the reference can be "from one end", and the pointer can be "Thinking Differently ";
● Reference has no const, pointer has const, and const pointer is immutable; (specifically, there is no Int & Const A, while const Int & A has, the former guidance itself means that the alias cannot be changed. This is of course, so this form is not required. The value indicated by the latter guidance cannot be changed)
● The reference cannot be blank or the pointer can be blank;
● "Sizeof reference" gets the size of the variable (object) pointed to, while "sizeof Pointer" gets the size of the pointer;
● Pointer and reference auto-increment (++) operations have different meanings;
● The reference is type-safe, but the pointer is not (the reference has more type checks than the pointer
Similarities and differences between pointers and references