What is the int.MaxValue on a 64-bit PC?

后端 未结 3 1080
暗喜
暗喜 2021-02-12 01:27
System.Console.WriteLine(int.MaxValue);

This line gives me the answer of 2,147,483,647 as I have a 32-bit PC.

Will the answer be s

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-12 02:01

    Yes, the answer will be the same on a 64-bit machine.

    In .NET, an int is a signed 32-bit integer, regardless of the processor. Its .NET framework type is System.Int32.

    The C# Language specification states:

    The int type represents signed 32-bit integers with values between –2,147,483,648 and 2,147,483,647.

提交回复
热议问题