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

Discussion

What will be the output of the program ?

#include <stdio.h>

int main()
{
    printf("India", "BIX\n");
    return 0;
}

 

  • A.Error
  • B.India BIX
  • C.India
  • D.BIX

Answer: C

Correct answer: India

printf takes a variable number of arguments and uses only as many as its format string calls for. "India" contains no conversion specifier, so the second argument is simply ignored and the output is India. (Too few arguments would be undefined behaviour; too many is harmless.)

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

Post your comment

Please log in or register to post a comment.