Each variable has a fixed type in C#, and integer (int) variable types are limited to whole numbers. C# has several other integer variable types, shown in this chart:
Type | Size (bytes) | Range | In Use |
---|---|---|---|
sbyte | 1 | -128 to 127 | sbyte sb = -12; |
byte | 1 | 0 to 255 | byte b = 12; |
short | 2 | -32,768 to 32,767 | short sn = -123; |
ushort | 2 | 0 to 65,535 | ushort usn = 123; |
int | 4 | -2,147,483,648 to 2,147,483,647 | int n = 123; |
uint | 4 | 0 to 4,294,967,295 | uint un = 123U; |
long | 8 | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 - a whole lot | long l = 123L; |
ulong | 8 | 0 to 18,446,744,073,709,551,615 | long ul = 123UL; |
dummies
Source:http://www.dummies.com/how-to/content/c-2008-integer-variable-types.html
No comments:
Post a Comment