[beginner to programming] look at C Primer Plus and see the placeholder problem, the test is different from what is written in the book.

The

code is as follows:

  1 -sharpinclude <stdio.h>
  2 
  3 void main(void) {
  4 
  5     int ten = 10;
  6     int two = 2;
  7     printf("%d minus %d is %d\n",ten,2,ten-two);//A
  8     printf("%d minus %d is %d\n",ten);  //B
  9 
 10 }

that"s what the book says:

clipboard.png

B%d
linux:

clipboard.png

:

clipboard.png

I would like to ask, where is this problem?
is the compiler of my system different from the compiler of the author in the book? Is the compiler smarter now?

C
May.18,2022

warning , warning

error , error

Book: the compiler will not report an error

so how do you understand it?


1.warning is a warning, the program can still be compiled; error is the error, the program cannot be compiled.
2.gcc is smart enough to detect problems, including an inconsistent number of parameters passed by printf, or even type errors.

Menu