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

Discussion

printf("%c", 100);

  • A.prints 100
  • B.prints ASCII equivalent of 100
  • C.prints garbage
  • D.none of the above

Answer: B

The statement prints the ASCII equivalent of 100.

The format %c prints its argument as a single character. The value 100 is read as a character code, and in ASCII code 100 is the letter d, so the output is d. It does not print the number 100 (A), which would need %d, and the output is not garbage (C), since 100 is a valid code, so (D) is wrong as well.

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

Post your comment

Please log in or register to post a comment.