Tuesday, 27 February 2018

C interview question 7

What will be the output of the given code?

#include <stdio.h>

int main(void)
{
char c='D';
printf ("%c",c+1);
return 0;
}

Output:
E
Reason:
Char c will store the ASCII value of D
When you print C+1 the next char to D that is E is being printed in the output.

No comments:

Post a Comment

C interview question 8

What will be the output of the given code? #include <stdio.h> int main(void) { float a = 3.14; printf("%f",a%3); ...