Multiple choice

What error will occur while running the following program? void main() { int const *t=8; printf(%d,++(*t)); }

  1. Lvalue required

  2. Invalid pointer

  3. Cannot modify the constant object

  4. Runtime error

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Here 't' is a pointer to a constant integer. But program wants to change the value of t by statement ++(*t), which is not possible. Hence, it will give the error 'Cannot modify the constant object'.