What are the differences between a pointer variable and a reference variable in C++?
A pointer can be re-assigned:int x = 5; int y = 6; int *p; p = &x; p = &y; *p = 10; assert(x == 5); assert(y == 10); A reference cannot be re-bound, and must be bound at initialization:int x = 5; int y = 6; int &q; // error int &r = x; … Read more