Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 same on a 64-bit PC?

like image 832
g.revolution Avatar asked Mar 15 '09 07:03

g.revolution


People also ask

What is the value of int Maxvalue?

Remarks. The value of this constant is 2,147,483,647; that is, hexadecimal 0x7FFFFFFF.

Why is 2,147,483,647 the max int value?

The number 2,147,483,647 (or hexadecimal 7FFFFFFF16) is the maximum positive value for a 32-bit signed binary integer in computing. It is therefore the maximum value for variables declared as integers (e.g., as int ) in many programming languages.

What is value & int Maxvalue in C#?

The maximum possible value of an integer is 2,147,483,647.


2 Answers

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.

like image 123
Daniel LeCheminant Avatar answered Sep 27 '22 17:09

Daniel LeCheminant


Yes.

int.MaxValue: 2,147,483,647

Source: https://www.dotnetperls.com/int-maxvalue

like image 23
Unknown Avatar answered Sep 27 '22 16:09

Unknown