728x90
반응형
1. 소스
test1.h
#include <stdio.h>
void test2(void);
typedef struct
{
char high_test[20];
char low_test[20];
}test_struct;
main.c
#include "test1.h"
test_struct user_test;
void main(void)
{
user_test.high_test[0] = 1;
user_test.high_test[1] = 2;
printf("main %d %d \r\n", user_test.high_test[0], user_test.high_test[1]);
test2();
printf("main %d %d \r\n", user_test.high_test[0], user_test.high_test[1]);
}
test2.c
#include "test1.h"
test_struct user_test;
void test2(void) {
user_test.high_test[0] = 3;
user_test.high_test[1] = 4;
}
2. 결과
728x90
반응형
'공부 > C언어' 카테고리의 다른 글
16. 구조체 전역선언(extern) (0) | 2018.12.06 |
---|---|
15.배열 초기화 하기 3가지 방법 (0) | 2018.10.19 |
13. typedef enum (0) | 2018.07.11 |
12. 구조체와 포인트 관계 (2) | 2018.07.06 |
11. static void 의 쓰임 (0) | 2018.05.25 |