I have this printf
statement at the end of my program:
我在程序结束时有这个printf语句:
printf("%d", total_candies);
total_candies
is an int
, and while I expect everything to work correctly, along with the actual number, I'm getting a weird percent sign at the end.
total_candies是一个int,虽然我希望一切正常,但实际数字,我最后会得到一个奇怪的百分号。
Can anyone tell me why this is happening?
谁能告诉我为什么会这样?
1 个解决方案
#1
46
When (non-null) output from a program doesn't include a trailing newline, zsh adds that color-inverted %
to indicate that and moves to the next line before printing the prompt; it's generally more convenient than bash's behavior, just starting the command prompt where the output ended.
当程序的(非空)输出不包含尾随换行符时,zsh会添加颜色反转的%来表示并在打印提示符之前移动到下一行;它通常比bash的行为更方便,只需启动输出结束的命令提示符。
#1
46
When (non-null) output from a program doesn't include a trailing newline, zsh adds that color-inverted %
to indicate that and moves to the next line before printing the prompt; it's generally more convenient than bash's behavior, just starting the command prompt where the output ended.
当程序的(非空)输出不包含尾随换行符时,zsh会添加颜色反转的%来表示并在打印提示符之前移动到下一行;它通常比bash的行为更方便,只需启动输出结束的命令提示符。