C# | 형식/키워드 범위 | .NET 형식 |
---|---|---|
sbyte | -128 ~ 127 | System.SByte |
byte | 0 ~ 255 | System.Byte |
short | –32,768 ~ 32,767 | System.Int16 |
ushort | 0 ~ 65,535 | System.UInt16 |
int | –2,147,483,648 ~ 2,147,483,647 | System.Int32 |
uint | 0 ~ 4,294,967,295 | System.UInt32 |
long | –9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 | System.Int64 |
ulong | 0 ~ 18,446,744,073,709,551,615 | System.UInt64 |
nint | 플랫폼에 따라 다름(런타임에 계산됨) | System.IntPtr |
nuint | 플랫폼에 따라 다름(런타임에 계산됨) | System.UIntPtr |
namespace Study // Note: actual namespace depends on the project name.
{
class Program
{
static void Main(string[] args)
{
// int 정수형 (-1 0 1 2 3 4)
int hp = 500;
int maxHp;
//TODO
maxHp = hp;
Console.WriteLine("hp");
// 여기서 변수는 hp,maxHp가 된다.
}
}
}