Complete the code to declare a reference to an integer variable.
int x = 10; int [1] y = x;
The symbol & is used in C++ to declare a reference variable.
Complete the code to declare a reference to a double variable.
double pi = 3.14; double [1] refPi = pi;
Use & to declare a reference variable in C++.
Fix the error in the reference declaration.
int a = 5; int [1] refA = &a;
References are declared with & and initialized with the variable itself, not its address. The code should be int &refA = a;.
Fill both blanks to declare a reference and initialize it correctly.
float value = 9.8f; float [1] refValue = [2];
Use & to declare a reference and initialize it with the variable name.
Fill all three blanks to declare a constant reference to an integer.
const int num = 100; const int [1] [2] = [3];
To declare a constant reference, use const int &refNum = num;.
