%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?
More Related Contents:
- Please explain the difference in the printfs below
- char c[]=”Albus”; printf(“%c”, c); [closed]
- Correct format specifier for double in printf
- How do you format an unsigned long long int using printf?
- What does “%.*s” mean in printf?
- What is the purpose of the h and hh modifiers for printf?
- What is the argument for printf that formats a long?
- Why is printf with a single argument (without conversion specifiers) deprecated?
- Unsigned values in C
- What is the conversion specifier for printf that formats a long?
- What precisely does the %g printf specifier mean?
- Why does printf not flush after the call unless a newline is in the format string?
- Printing leading 0’s in C
- How should I print types like off_t and size_t?
- printf format specifiers for uint32_t and size_t
- printf adds extra `FFFFFF` to hex print from a char array [duplicate]
- call printf using va_list
- Difference between signed / unsigned char [duplicate]
- Behaviour of printf when printing a %d without supplying variable name
- using printf to print out floating values
- Whitespace before %c specification in the format specifier of scanf function in C
- How to use “zd” specifier with `printf()`?
- Passing too many arguments to printf
- printf with “%d” of numbers starting with 0 (ex “0102”) giving unexpected answer (ex ‘”66″)
- Wrong format specifiers in scanf (or) printf
- What primitive data type is time_t? [duplicate]
- Printf long long int in C with GCC?
- Why is int rather than unsigned int used for C and C++ for loops?
- cross-platform printing of 64-bit integers with printf
- What is the difference between %f and %lf in C?