C Programming MCQ - 1 [ Cannot Modify Constant Value ]



Question : What will be the Output of the Program.?


#include<stdio.h>
void main()
{
int  const * p=5;
printf("%d",++(*p));
}

Answer

Compiler error: Cannot modify a constant value


Explanation :

  1. p is a pointer to a “Constant Integer“.
  2. We tried to change the value of the “Constant Integer“.
  3. Value of the Constant Integer Cannot Be Modified.