Skip to content

Tag Archives: C++-References

C++ has a tradition of introducing new improvements and features in every 3 years in the form of a standard. With the last standard having… Read More
Prerequisites: lvalue and rvalue in C++, References in C++“l-value” refers to a memory location that identifies an object. “r-value” refers to the data value that… Read More
Pointers: A pointer is a variable that holds memory address of another variable. A pointer needs to be de referenced with * operator to access… Read More
We all are familiar with an alias in C++. An alias means another name for some entity. So, a reference variable is an alias that… Read More
Prerequisite: Pointers vs References in C++. For clear understanding, let’s compare the usage of a “pointer to pointer” VS “Reference to pointer” in some cases.… Read More
Output of following C++ program? #include<iostream> using namespace std;    int main() {   int x = 10;   int& ref = x;   ref = 20;   cout… Read More
Predict the output of following C++ program. #include<iostream> using namespace std;    int &fun() {     static int x = 10;     return x; } int main()… Read More
Which of the following functions must use reference. (A) Assignment operator function (B) Copy Constructor (C) Destructor (D) Parameterized constructor Answer: (B) Explanation: A copy… Read More
Which of the following is FALSE about references in C++ (A) References cannot be NULL (B) A reference must be initialized when declared (C) Once… Read More
What is the return value of f(p, p) if the value of p is initialized to 5 before the call? Note that the first parameter… Read More

Start Your Coding Journey Now!