Question:

Choose the indirection or value at operator used in C++ from the options given below.

Show Hint

In C++, the asterisk (*) is used to dereference a pointer, while the ampersand (&) is used to obtain the address of a variable.
  • ++
  • *
  • &
  • +
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is B

Solution and Explanation

Step 1: Understanding the operator in C++.
In C++, the indirection operator (also called the dereference operator) is represented by the asterisk (*) symbol. It is used to access the value stored at the memory address pointed to by a pointer.
Step 2: Evaluating the options.
  • (A) ++: Incorrect. The increment operator (++) is used to increase the value of a variable.
  • (B) *: Correct. The asterisk (*) is the dereference operator in C++, used to access the value at a pointer's address.
  • (C) &: Incorrect. The ampersand (&) is the address-of operator, used to get the memory address of a variable.
  • (D) +: Incorrect. The plus (+) operator is used for addition, not for indirection.

Step 3: Conclusion.
The correct answer is (B) *, as it is the indirection operator in C++. Final Answer:} *.
Was this answer helpful?
0
0