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
반응형
'공부 > C언어' 카테고리의 다른 글
11. static void 의 쓰임 (0) | 2018.05.25 |
---|---|
10. __VA_ARGS__ 의 쓰임 (0) | 2018.05.24 |
8.[C언어]공용체 사용하기_소수점 값을 HEX 로 바꾸기 (0) | 2018.03.14 |
7.[C언어] 구조체 응용하기 (0) | 2018.03.13 |
6.[C언어] 배열 초기화 하기 (0) | 2018.03.09 |