Why unsigned int contained negative number

前端 未结 4 2276
谎友^
谎友^ 2020-12-20 16:38

What I know about unsigned numerics (unsigned short, int and longs), that It contains positive numbers only, but the following simple program successfully assigned a negativ

4条回答
  •  温柔的废话
    2020-12-20 16:56

    %i is the format specifier for a signed integer; you need to use %u to print an unsigned integer.

提交回复
热议问题