Question
#include<stdio.h>
int main()
{
int c=08;
printf("%c",c);
return 0;
}
What is the output of the following program?
#include<stdio.h>
int main()
{
int c=08;
printf("%c",c);
return 0;
}
Answer: Option C
Was this answer helpful ?
Any number starting with 0 is treated as an octal value.
Here, 08 is an invalid octal value and hence the compiler throws the following error:
myprog.c:3:8: error: invalid digit "8" in octal constant
Was this answer helpful ?
Submit Solution