10.6k views
5 votes
The statement ("%10s", 123456) outputs ________. (note: * represents a space)

User Karfus
by
7.1k points

1 Answer

4 votes

The statement ("%10s", 123456) outputs ****123456.

The %10s format specifier tells the printf() function to print a string that is at least 10 characters wide. The 123456 is converted to a string and then printed, but it is only 6 characters long. The printf() function pads the string with spaces to make it 10 characters wide.

So, the output of the statement is ****123456.

User ThibaudL
by
8.5k points