<C Primer Plus>3 Arguments and Pitfalls of Printf()

 1 #include <stdio.h>
 2 int main(void){
 3     int n = 4;
 4     int m = 5;
 5     float f = 7.0f;
 6     float g = 8.0f;
 7 
 8     printf("%d
", n, m);//too many arguments
 9     printf("%d %d %d
", n);//too few arguments
10     printf("%d %d 
", f, n);//wrong kinds of values
11     return 0;
12 }

Remeber :

1 C now has a function-prototyping mechanism that checks whether a function call has the correct number and correct kind of arguments . 

2 the Printf() and scanf() take a variable number of arguments.

3 Check too see whether you've used the correct number of printf() arguments ,when  your program doesn't print the expected number of values or unexpected values.

原文地址:https://www.cnblogs.com/michael2016/p/6581572.html