You have assigned the address of Value to the pointer P, Which statement will display the value stored in Value?

[amp_mcq option1=”cout<

The correct answer is D. cout<<*P;

A pointer is a variable that stores the address of another variable. The asterisk (*) operator is used to dereference a pointer, which means to access the value stored at the address that the pointer points to.

In this case, the pointer P stores the address of the variable Value. Therefore, the statement cout<<*P; will display the value stored in Value.

The other options are incorrect because they do not dereference the pointer P. The statement cout<<P; will print the address of the variable Value, not the value stored in Value. The statement cout<<&P; will print the address of the pointer P, not the address of the variable Value.

Exit mobile version