<分区>
我读过几篇关于这个主题的文章,但有些人说应该如何做取决于你所处的体系结构和系统(Windows/Linux),那么有没有合适的方法来独立于这个平台?
<分区>
我读过几篇关于这个主题的文章,但有些人说应该如何做取决于你所处的体系结构和系统(Windows/Linux),那么有没有合适的方法来独立于这个平台?
最佳答案
%zu
为 size_t
,有
%z
长度,和%u
未签名详情请见
7.21.6.1 The fprintf function
6 The flag characters and their meanings are:
...
z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument.
关于c - scanf 和 printf size_t 变量的正确方法(平台无关),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41320824/