In: Computer Science
How is a const pointer similar and different from a reference variable? And please give a good example.
Please help! Thank you!
SIMILARITIES
DIFFERENCES
int x = 12; int *p = &x; OR int *p; p = &x;
int x=12; int &p=x;
int a = 5; int b = 6; int *p; p = &a; p = &b; *p = 10; assert(a == 5); assert(b == 10);
int a = 5; int b = 6; int &r = a;