Answers for "what does int& mean in c++"

1

int&

int a = 3;
int b = 4;
int* pointerToA = &a;
int* pointerToB = &b;
int* p = pointerToA;
p = pointerToB;
printf("%d %d %dn", a, b, *p); // Prints 3 4 4
int& referenceToA = a;
int& referenceToB = b;
int& r = referenceToA;
r = referenceToB;
printf("%d %d %dn", a, b, r); // Prints 4 4 4
Posted by: Guest on November-18-2020

Browse Popular Code Answers by Language