unsigned long 0 < -1?

后端 未结 4 2223
南笙
南笙 2021-02-15 10:59

I don\'t get this one!

#include 

int main()
{
    unsigned short t1 = 0, t2 = 0;

    if( t1 < t2-1 )
        printf(\" t1 < t2-1\\n\");

          


        
4条回答
  •  星月不相逢
    2021-02-15 11:11

    Iam not sure but I suspect that the expression t2-1 automatically widened into an int value. I do not have the c standard here what the exact conversion rules are, but I believe types smaller than int are automatically widened.

提交回复
热议问题