C语言错误集合

C语言错误集合
    1 #include <stdio.h>
    2
    3 int main()
    4 {
    5     int i = 5;
✹   6     printf("%d %d\n",i);   / * wrong */
    7     return 0;
    8 }
View Code C语言错误集合
trp@DESKTOP-ET7Q9JO:~$ gcc -o t1 t1.c
t1.c: In function ‘main’:
t1.c:6:17: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
    6 |     printf("%d %d\n",i);
      |                ~^
      |                 |
      |                 int
View Code

 

C语言错误集合
    1 #include <stdio.h>
    2
    3 int main()
    4 {
    5     int i = 5, j = 6;
✹   6     printf("%d\n",i, j);
    7     return 0;
    8 }
View Code C语言错误集合
trp@DESKTOP-ET7Q9JO:~$ gcc -o t2 t2.c
t2.c: In function ‘main’:
t2.c:6:12: warning: too many arguments for format [-Wformat-extra-args]
    6 |     printf("%d\n",i, j);
View Code

 

上一篇:2021/11/9


下一篇:企业发票异常分析---分离进项与销项