Machine-translated by Google. Questions are authored in English.
Top

Discussion

#include <stdio.h>
int main()
{
    int i;
    if (printf("0"))
        i = 3;
    else
        i = 5;
    printf("%d", i);
    return 0;
} 

 

  • A.3
  • B.5
  • C.03
  • D.05

Answer: C

Correct answer: 03

printf returns the number of characters written. It prints 0 - that is one character - and returns 1, which is true, so i becomes 3. The output is therefore the 0 from the condition followed by the 3: 03.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.