What is the difference between “int” and “uint” / “long” and “ulong”?

后端 未结 5 808
梦毁少年i
梦毁少年i 2020-12-07 11:44

I know about int and long (32-bit and 64-bit numbers), but what are uint and ulong?

5条回答
  •  时光说笑
    2020-12-07 12:34

    The difference is that the uint and ulong are unsigned data types, meaning the range is different: They do not accept negative values:

    int range: -2,147,483,648 to 2,147,483,647
    uint range: 0 to 4,294,967,295
    
    long range: –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
    ulong range: 0 to 18,446,744,073,709,551,615
    

提交回复
热议问题