previous | start | next

Formatted printing

printf("You input values %d and %d\n", x, y);

If the value of x is 5 and y is 10, this printf statement will output:

You input values 5 and 10

Other conversion specifications:

Conversion spec Expected value type
%d int
%f float or double
%c char
%s char array1

1For the %s format, the char array is expected to have an entry containing the null character, '\0', that indicates the end of the character string. The printf function keeps printing successive characters until it finds this null character.



previous | start | next