printf for size_t

2019-04-04 05:32发布

问题:

Is there any way to give printf a size_t without either casting it first or generating a compiler warning? (I always compile with -Wall.)

回答1:

printf("%zu", sizeof(whatever));