我有以下内容
size_t i = 0;
uint32_t k = 0;
printf("i [ %lu ] k [ %u ]\n", i, k);
Run Code Online (Sandbox Code Playgroud)
编译时我收到以下警告:
format ‘%lu’ expects type ‘long unsigned int’, but argument has type ‘uint32_t’
Run Code Online (Sandbox Code Playgroud)
当我使用夹板运行时,我得到以下内容:
Format argument 1 to printf (%u) expects unsigned int gets size_t: k
Run Code Online (Sandbox Code Playgroud)
非常感谢任何建议,
我一直在阅读这篇文章,并且怀疑打印此数据类型的正确且可移植的方法是什么?
uint_fast8_t
uint_fast16_t
uint_fast32_t
uint_fast64_t
Run Code Online (Sandbox Code Playgroud)
也签了。