开发者

What does it mean when numbers end with U

As in this code:

int nx = (int)((re开发者_JS百科v3[gx]) / 193U);

Whats with the U in the end of 193 ?


The u is unsigned, that is: 1 is the int value 1, and 1u is the unsigned int value 1.


It means that the number is an unsigned int, which is a data type much like an int except that it has no negative values, which is a trade-off it makes so that it can store larger values (twice as large as a regular int).


It means it's an unsigned int constant. It's a way of telling the compiler to use a specific type for a constant where it wouldn't otherwise know the type. A naked 193 would be treated as an int normally.

It's similar to the L suffix for long, the ULL for unsigned long long and so forth.


U means unsigned.

Have a look here for more: http://cplus.about.com/od/learnc/ss/variables_6.htm


It means to treat the value as an unsigned value

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜