공부/C언어
9.[C언어] 구조체 typedef
유저라인
2018. 4. 3. 15:49
728x90
반응형
main.c
#include <stdio.h>
struct test1
{
int xpos;
};
typedef struct
{
int ypos;
}test3;
int main(void)
{
struct test1 test2;
test3 test4;
test4.ypos;
test2.xpos = 10;
test4.ypos = 20;
printf("%d\n",test2.xpos);
printf("%d\n", test4.ypos);
return 0;
}
typedef를 쓰면 struct를 생략하게 된다.
728x90
반응형