Write the syntax for Reference Operator.
Answers
Answered by
10
Answer:
syntax example :-
#include<iostream>
using namespace std;
int main()
{
int x = 10;
// ref is a reference to x.
int& ref = x;
// Value of x is now changed to 20
ref = 20;
cout << "x = " << x << endl ;
// Value of x is now changed to 30
x = 30;
cout << "ref = " << ref << endl ;
return 0;
}
Output :-
x = 20
ref = 30
Hope it will help you
Similar questions