Desc :
Source Code :
#include <stdio.h>
#include <string.h>
void print(struct tagStaff *pone);
struct tagStaff
{
char name[10];
char phone[20];
char address[100];
};
void main()
{
struct tagStaff one;
struct tagStaff *pone;
pone = &one;
strcpy((*pone).name, "홍길동");
strcpy((*pone).phone, "010-1234-5678");
strcpy((*pone).address, "서울시 강남구");
print(&one);
}
void print(struct tagStaff *pone)
{
printf("이름: %s\n", pone->name);
printf("전화: %s\n", pone->phone);
printf("주소: %s\n", pone->address);
}
Result :
안올라가져서 섞여버렸다,,,,,,,,,,,,,, 안돼,,,,,,,,,,,,,,,,,,,
'C' 카테고리의 다른 글
[C] 132 함수 포인터 사용하기 (1) | 2021.01.31 |
---|---|
[C] 131 포인터의 포인터를 함수에서 사용하기 (2) | 2021.01.31 |
[C] 130 포인터의 포인터 (1) | 2021.01.30 |
[C] 129 void형 포인터를 함수에서 사용하기 (1) | 2021.01.29 |
[C] 128 void 포인터 (1) | 2021.01.29 |