Welcome !


Search Community

PEDS Reports and Data Tools

How to printf "unsigned long" in C?

How to printf "unsigned long" in C?

Postby Matthew Grace, IV » September 29th, 2020, 10:32 pm

I can never understand how to print unsigned long datatype in C.

Suppose unsigned_foo is an unsigned long, then I try:

printf("%lu\n", unsigned_foo)
printf("%du\n", unsigned_foo)
printf("%ud\n", unsigned_foo)
printf("%ll\n", unsigned_foo)
printf("%ld\n", unsigned_foo)
printf("%dl\n", unsigned_foo)
And all of them print some kind of -123123123 number instead of unsigned long that I have.
Matthew Grace, IV
Posts: 1

Return to PEDS Reports and Data Tools

  • In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
  • Most users ever online was 583 on January 15th, 2020, 9:38 am
  • Users browsing this forum: No registered users and 3 guests