How to printf "unsigned long" in C? How to printf "unsigned long" in C? c c

How to printf "unsigned long" in C?


%lu is the correct format for unsigned long. Sounds like there are other issues at play here, such as memory corruption or an uninitialized variable. Perhaps show us a larger picture?


For int %d

For long int %ld

For long long int %lld

For unsigned long long int %llu


  • %lu for unsigned long
  • %llu for unsigned long long