且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我们怎样才能在变量声明中使用print()函数?

更新时间:2023-01-19 17:20:15

写在 printf文档 [ ^ ]:

Written in the printf documentation[^]:
成功时,返回写入的字符总数。
On success, the total number of characters written is returned.


请参阅 printf - C ++参考​​a> [ ^ ]描述:

See the printf - C++ Reference[^] description:
Quote:

返回值​​>

成功时,返回写入的字符总数。

Return Value
On success, the total number of characters written is returned.

您正在打印一个字符(空格),所以 printf()返回1.然后添加 m 的值,即5并将结果分配给 k

You are printing one character (a space), so printf() returns 1. You then add the value of m which is 5 and assign the result to k.