Sail E0 Webinar
Question
What is the output of this C code?
int main()
{
float x = 'a';
printf("%f", x);
return 0;
}
Options:
A .  a
B .  run time error
C .  a.0000000
D .  97.000000
Answer: Option D


Since the ASCII value of a is 97, the same is assigned to the float variable and printed.
Output:
$ cc pgm8.c
$ a.out
97.000000



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers