::public/C++

typedef

해맑은욱 2020. 6. 15. 11:13

*typedef를 이용하여 사용자 지정 타입을 정의(type define)할 수 있다

 

typedef int INT;    // INT라는 이름으로 int 사용 가능.
 
INT num = 1;
INT* ptr = #
 
typedef struct
{
    int xpos;
    int ypos;
} Point;            // Point라는 이름으로 구조체 사용 가능.
 
Point p1;
p1.xpos = 1;
p1.ypos = 1;
cs