4
Answers

integer type in C#

George George

George George

16y
2.3k
1

Hello everyone,


1.

C# has integer types, int, int32, int64 and long. In my understanding, int32 is always 32-bit, int64 and long are always 64-bit.

My understanding correct?

2.

How about int? Is it 32-bit or 64-bit or depends on how we build application (build as 32-bit? build as 64-bit or any CPU?)


thanks in advance,
George

Answers (4)
0
George George

George George

NA 778 0 16y

Thanks Alan,

 

Cool!

 

 

regards,

George

0
Alan

Alan

NA 8.3k 0 16y

One thing I've always liked about C# is that the integer types are always the same length no matter what platform you're running on.

This contrasts with the position under C/C++ where the short, int and long types can overlap depending on the platform.

For example, in Win32 programming, int and long are both 4 byte integers. If you want an 8 byte integer, you have to use 'long long' !

0
George George

George George

NA 778 0 16y

Cool, question answered!

 

 

regards,

George

0
jeevan mummadi

jeevan mummadi

NA 157 0 16y

int  is signed 32 bit number,int system type is System.int32

long is signed 64 bit number,long system type is System.int64