• Please make sure to complete your profile by filling in any details pertaining to your company, name, photo, socials and contact information for any updates.
  • Need a hand with one of our platforms? post it under the support forum!
  • Reach out to us by emailing devsupport@redtorrentmedia.app if you don't see a response in 24/48 hours. - Please forward your thread!

How to printf "unsigned long" in C?


New member
I can never understand how to print unsigned long datatype in C.
minecraft classic

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.