Correct printf format specifier for size_t: %zu or %Iu?

后端 未结 4 1627
不知归路
不知归路 2020-11-29 08:02

I want to print out the value of a size_t variable using printf in C++ using Microsoft Visual Studio 2010 (I want to use printf instea

4条回答
  •  猫巷女王i
    2020-11-29 08:30

    The Microsoft documentation states:

    The hh, j, z, and t length prefixes are not supported.

    And therefore %zu is not supported.

    It also states that the correct prefix to use for size_t is I – so you'd use %Iu.

提交回复
热议问题