What is the difference between %zu and %lu in string formatting in C? %lu is used for unsigned long values and %zu is used for size_t values, but in practice, size_t is just an unsigned long. CppCheck complains about it, but both work for both types in my experience.
Is %zu just a standardized way of formatting size_t because size_t is commonly used, or is there more to it?
size_tcould beunsigned long longand then%luwould be wrong but%zuis still correct.size_tis 32-bits, in 64-bit it is 64 bits. Butlongis 32 bits in both.unsigned longis at least 32-bit.size_tis at least 16-bit.