*ptrdata is a pointer to a data type. The expression *ptrdata++ is evaluated…
2022
*ptrdata is a pointer to a data type. The expression *ptrdata++ is evaluated as (C++) –
- A.
*(ptrdata++)
- B.
(*ptrdata)++
- C.
*(ptrdata)+
- D.
Depends on compiler
Attempted by 199 students.
Show answer & explanation
Correct answer: A
The correct option is Option 1.
In C++, different operators have different "priority" levels (precedence).
Priority: The
++(postfix increment) has higher priority than the*(dereference).How it works: Because
++has higher priority, it "grabs" the pointer first.The Result: The computer first deals with the pointer's address (
ptrdata++) and then looks at the value inside that address (*).