Description “Return by Reference”.

C++ is considered not only as a language of Object Oriented Programming, but also an intermediate level language. It identifies both high and low level languages. It became easy and widely used in computer programs and that is the reason why we should understand the definition and its function as well. Such as Return by reference is one of the C++ functions that you will favor. Click the below to find the significant information for your subject. 

What is Return by reference? 

Return by reference is returning the certain variable or object while the reference is built to be returned. When it is passed better than a stable pointer as syntax. The constant pointer can’t be stated that it is not initialized as a reference. While reference operates as a synonym in a scope, it can be runned without a pointer. Only when the operator returns the reference to an object and it is overloaded, the language construct will not replace the reference. 

Below is a simple example of program of return by reference:          

#include <iostream>

int n;
int& test();

int main() {
test() = 5;
return 0;

int& test() {
return n;


With the explanation above, it is identified by return by reference with the function of test(). It gets back the result is int&. Return n is the statement of the return but the result is n, it is to get back the n value.

After that, the value of n is shown and 5 is identified in the left code side of the variable.

When returning a value, that value is transcripted into the pile then copied to another variable in the scope of the calling function. If it is changed by the earliest value, this original value will be returned by the caller because it keeps a copy also. 


From your message, you know that C++ is one of the most powerful and widely used programming languages of all time. C++ is also one of the oldest programming languages in use today. If Return by Reference is still not familiar with you, ready the above instruction for your reference again. I am confident you have useful lessons for procedure oriented programming with the return function. Thus, if you have any question related to CPP’s functions, follow up the next article to understand more. We wish you a splendid day filled with knowledge of Procedure Oriented Programming (CPP).

Scroll to Top