Yahoo Interview Question
Software Engineer / DevelopersThere are 4 differences.
1. Pointer can be initialized later after it is declared, whereas reference has be initialized during declaration.
2. Pointer can point to null, whereas null reference is not permitted.
3. An array of pointers like int *p[10] is allowed where an array of references like int &p[10] is not allowed
4. You can have a pointer to pointer whereas you cannot have a reference to a reference.
Differences between pointer and reference
- Saurabh Abichandani December 04, 20061 Reference syntax like pointers semantics like value
2 Must be initialized while declaration and cannot change it once initialized
3 reference cannot be dereferenced