Knowee
Questions
Features
Study Tools

The indirection operator (*) returns the value stored in the address that the operand contains. The expression is itself an lvalue.The indirection and address-of operators are inverses of one another. The result of *&x is x.

Question

The indirection operator (*) returns the value stored in the address that the operand contains. The expression is itself an lvalue.The indirection and address-of operators are inverses of one another. The result of *&x is x.

🧐 Not the exact question you are looking for?Go ask a question

Solution

Yes, you are correct. The indirection operator (*) in C++ is used to access the value at a certain memory location. If you have a pointer variable, you can use the indirection operator to get the value that the pointer is pointing to.

On the other hand, the address-of operator (&) is used to get the memory address of a variable.

As you mentioned, these two operators are inverses of each other. If you have a variable x, and you get the address of x using the address-of operator (&x), and then you use the indirection operator on that address (*&x), you will get back the original variable x.

This is because the address-of operator gives you the address where the variable is stored, and the indirection operator gives you the value stored at a certain address. So when you use them together like this, they cancel each other out and you get back the original variable.

This problem has been solved

Similar Questions

The operator used to get value at address stored in a pointer variable isa.*b.&c.&&d.||

In C, what is the primary purpose of the indirection operator?

In C, what is the primary purpose of the indirection operator?Marks : 1Negative Marks : 0Answer hereTo create new variablesTo obtain the memory address of a variableTo access the value stored at a memory addressTo perform arithmetic operations

Which operator returns the address of a variable?a.&b.%c.^d.*

If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable? ans. -> * . &

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.