<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", n, m);//too many arguments
 9     printf("%d %d %d\n", n);//too few arguments
10     printf("%d %d \n", 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.

posted @   Micheal_you  阅读(136)  评论(0)    收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示