0

I have to compile a c program files with %zu specifier but the printf function always show zu without showing the true value. I have use dev-C++5.11 and my TDM_GCC is version 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);
}

And the result is

SIZE_MAX = 4294967295

size = zu

May I know how to make compiler show the true value in the size. Thanks You.

Community
  • 1
  • 1
lawrence
  • 151
  • 1
  • 8

0 Answers0