1.

Explain the format string "%5d%s %c"(a) five characters as a decimal integer, then reads the remaining as a string and then scans the first non-whitespace character(b) compile error(c) run-time error(d) read first five characters as a decimal and ignore the restThis question was addressed to me by my college professor while I was bunking the class.The question is from scanf topic in division Input and Output in C of C

Answer»

The correct option is (a) five CHARACTERS as a DECIMAL INTEGER, then reads the remaining as a STRING and then scans the first non-whitespace character

To explain I would say: The above format string reads the first five characters as a decimal integer, then reads the remaining as a string until a space, newline or TAB is found, then reads the first non-whitespace character.



Discussion

No Comment Found

Related InterviewSolutions