views:

799

answers:

3

Hi.

System.Console.WriteLine(int.MaxValue);

This line gives me the answer of 2147483647 as I have a 32-bit PC.

Will the answer be same on a 64-bit PC?

+6  A: 

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 –2147483648 and 2147483647.

Daniel LeCheminant
+2  A: 

Yes. http://dotnetperls.com/Content/int-Max-Min.aspx

Unknown
+4  A: 

int is just an alias for Int32 - it's defined in the C# specification. Therefore int.MaxValue is the same as Int32.MaxValue which will always be 2147483647.

Jon Skeet