C Programming :: Variables & Data Types - Discussion
Home > C Programming > Variables & Data Types > MCQs Questions Discussion
12 / 51
What will be output of the following "c" code?
#include<stdio.h>
int main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i, ++j);
}
#include<stdio.h>
int main()
{
const int i=4;
float j;
j = ++i;
printf("%d %f", i, ++j);
}
Aerror: increment of read-only variable 'i'
B4 5
C5 6.0
DNone of these
Answer: Option (Login/Signup)
Show Explanation
Asked In ::
TRICK
Variable i is declared as const, therefore we cannot increment or update the value of i any further.
Here, we will get an error saying: error:increment of read-only variable 'i'.
Hence, option A is correct.
Read Full Answer
Report Error
Please Login First Click Here