728x90
반응형
0.파일
1. main.c
#include "test.h"
char test[10] = "123456789/";
test_struct user_test_struct;
void test_ham(){
int i = 0;
for (i = 0; i < 5; i++)
{
user_test_struct.high_test[i] = test[i];
}
for (i = 0; i < 5; i++)
{
user_test_struct.low_test[i] = test[i+5];
}
}
void main(void) {
int i = 0;
test_ham();
printf("high =%s\r\n", user_test_struct.high_test);
printf("low =%s\r\n", user_test_struct.low_test);
printf("test =%s\r\n", test);
test2(&user_test_struct);
init_arr(test,10);
}
2.test2.c
#include "test.h"
void test2(test_struct *user_test2)
{
printf("high=%s\r\n", user_test2->high_test);
printf("low =%s\r\n", user_test2->low_test);
}
3.test.h
#include <stdio.h>
typedef struct
{
char high_test[20];
char low_test[20];
}test_struct;
void test2(test_struct *user_test2);
4. 결과
728x90
반응형
'공부 > C언어' 카테고리의 다른 글
9.[C언어] 구조체 typedef (0) | 2018.04.03 |
---|---|
8.[C언어]공용체 사용하기_소수점 값을 HEX 로 바꾸기 (0) | 2018.03.14 |
6.[C언어] 배열 초기화 하기 (0) | 2018.03.09 |
[c언어] 포인트 문자열 (0) | 2018.03.09 |
5.[stm32f103][C언어] 구조체 응용하기(구조체 연결) (0) | 2018.02.28 |