“unsigned int” prints as a negative number?

前端 未结 3 1758
无人及你
无人及你 2021-01-06 00:48

I am taking an integer, in this case 192, and left shifting it 24 spaces. The leading 1 is causing it to become negative, it seems.

unsigned int i = 192;
uns         


        
3条回答
  •  心在旅途
    2021-01-06 01:37

    You wan to do NSLog(@"newnumber is %u",newnumber);

    %d converts it back to a signed int.

提交回复
热议问题