Home »
C++ programs »
C++ basic programs
C++ program to use function as a LVALUE using reference variable
Learn, how can we use function as a LVALUE in C++ using the reference variables?
[Last updated : March 01, 2023]
In this program you will learn how to use function as a LVALUE in C++ programming language.
function as a LVALUE using reference variable example in C++
/*C++ program to use function as a LVALUE using reference
variable.*/
#include <iostream>
using namespace std;
int var ;
int& fun()
{
return var;
}
int main()
{
//Function used as LVALUE
fun() = 10;
cout << "Value of var : " << var << endl;
return 0;
}
Output
Value of var : 10