There is only one difference, which is the newline character\n, that is, %d will not wrap after output, while %d\n will wrap.
Conceptual analysis:
1. %d---output an integer.
2. \n---? Enter and line feed.
1. The demonstration without line breaks is as follows:
1. %d code:
2. Execution output:
2. Line breaks The symbol demonstration is as follows:
1. %d\nCode:
2. Execution output:
Extended information:
Newline character The difference between it and the carriage return character:
Both of them mean "enter". When typing, the carriage moves from left to right. After typing a line, the carriage must be returned to On the far left, this process can be understood as "carriage return", so carriage return means returning the word carriage to the first column. And if you want to continue typing, you need to move the character carriage to the next line and continue typing from left to right, one by one.
The concept of "carriage return" continues in modern computer languages. In the past, the concept of a typewriter's carriage was equivalent to the current cursor on the screen. Therefore, scientists used "carriage return" when designing the C language. This concept:
1. '\r' moves the cursor to the first column of this line.
2. The '\n' of carriage return and line feed means moving the cursor to the first column of this line and then changing the line (moving to the next line).
Reference: Baidu Encyclopedia--Line breaks