<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.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】凌霞软件回馈社区,携手博客园推出1Panel与Halo联合会员
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步