Skip to content

Tag Archives: References

This article focuses on function/method overloads by references, as well as the types of arguments that can be passed. Prerequisites: l-value references. r-value references. Move… Read More
Prerequisites: lvalue reference rvalue reference Copy Semantics (Copy Constructor) References: In C++ there are two types of references- lvalue reference: An lvalue is an expression… 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
Output of following C++ program? #include<iostream> using namespace std;    int main() {   int x = 10;   int& ref = x;   ref = 20;   cout… Read More
#include<iostream> using namespace std;    int &fun() {     int x = 10;     return x; } int main() {     fun() = 30;     cout << fun();     return… 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!