Menu Close

c语言中的%d 和 %zu 有什么区别?

%d输出int型。
%zu输出size_t型。size_t在库中定义为unsigned int。
一个是整型,一个是无符号整型。
补充:如果%zu不能使用,可以用%u取代。%zu不能输出负数。

 

size_t existed at least since C89 but the respective format specifier %zu (specifically the length modifier z) was added to the standard only since C99.

除教程外,本网站大部分文章来自互联网,如果有内容冒犯到你,请联系我们删除!
Posted in C语言编程