C

[C] 119 구조체 사용하기

qkrwngus 2021. 1. 29. 19:23

Desc :

구조화된 데이터를 한 묶음으로 처리할 때 사용

 


Source Code :

#include <stdio.h>
#include <string.h>

struct tagStaff
{
	char name[10];
	char phone[20];
	char address[100];
};

void main()
{
	struct tagStaff one;

	strcpy(one.name, "홍길동");
	strcpy(one.phone, "010-1234-5678");
	strcpy(one.address, "서울시 강남구");

	printf("이름: %s\n", one.name);
	printf("전화: %s\n", one.phone);
	printf("주소: %s\n", one.address);
}

 


Result :