게임개발 C#-2 (정수형식, 변수)

샘물공원·2023년 6월 7일
0

게임개발자

목록 보기
3/4

C# 정수형식

C#형식/키워드 범위.NET 형식
sbyte-128 ~ 127System.SByte
byte0 ~ 255System.Byte
short–32,768 ~ 32,767System.Int16
ushort0 ~ 65,535System.UInt16
int–2,147,483,648 ~ 2,147,483,647System.Int32
uint0 ~ 4,294,967,295System.UInt32
long–9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807System.Int64
ulong0 ~ 18,446,744,073,709,551,615System.UInt64
nint플랫폼에 따라 다름(런타임에 계산됨)System.IntPtr
nuint플랫폼에 따라 다름(런타임에 계산됨)System.UIntPtr

C# 변수

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가 된다.
        }
    }
}
profile
게임개발

0개의 댓글