Q:

C++ program to demonstrate use of reference variable

0

C++ program to demonstrate use of reference variable

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Reference variable example in C++

/*C++ program to demonstrate use of reference variable.*/
#include <iostream>
using namespace std;
 
int main()
{
    int a=10;
 
    /*reference variable is alias of other variable, 
    It does not take space in memory*/
 
    int &b = a; 
 
    cout << endl << "Value of a: " << a;
    cout << endl << "Value of b: " << b << endl;
 
    return 0;
}

Output

    Value of a: 10
    Value of b: 10

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Most popular and Searched C++ solved programs with Explanation and Output

Similar questions


need a help?


find thousands of online teachers now
C++ program to use function as a LVALUE using refe... >>
<< C++ program to demonstrate use of Scope Resolution...