Meaning of U suffix

后端 未结 2 1613
面向向阳花
面向向阳花 2020-11-29 01:15

What does the postfix (or suffix) U mean for the following values?

0U
100U
相关标签:
2条回答
  • 2020-11-29 01:51

    Integer constants in C and C++ can optionally have several suffixes:

    123u      the value 123 is an unsigned int
    123l       (that's a lowercase L) 123 is a signed long
    123L      ditto
    123uL    unsigned long
    123LL    a signed long long, a 64 bit or 128 bit value (depending on the environment)
    123uLL  unsigned long long

    0 讨论(0)
  • 2020-11-29 01:52

    It stands for unsigned.

    When you declare a constant, you can also specify its type. Another common example is L, which stands for long. (and you have to put it twice to specify a 64-bit constant).

    Example: 1ULL.

    It helps in avoiding explicit casts.

    0 讨论(0)
提交回复
热议问题