我必须使用%zu说明符来编译c程序文件,但printf函数始终显示zu而不显示真实值。我已经使用dev-C ++ 5.11,而我的TDM_GCC是版本4.9.2
#include <stdio.h>
#include <stddef.h>
#include <stdint.h>
int main(void) {
const size_t x = 150;
int a[x];
for (size_t i = 0;i < x; ++i)
a[i] = i;
printf("SIZE_MAX = %lu\n", SIZE_MAX);
size_t size = sizeof(a);
printf("size = %zu\n", size);
}
结果是
SIZE_MAX = 4294967295
size = zu
我可以知道如何使编译器在大小上显示真实值。 谢谢你。