C/C++ 언어 구조체 템플릿은 함수 외부 변수는 함수 내부 선언
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* 구조체 템플릿은 함수 외부 변수는 함수 내부 선언 */ #include <stdio.h> struct list { char name[20], sex; int age; }; void main(void) { void declareOutInside( struct list *); struct list person; declareOutInside(&person); printf("%s, %c, %d\n", person.name , person.sex, person.age); } void declareOutInside( struct list *pperson) { printf("enter the value of"); printf(" name, sex, age : "); scanf("%s %c %d", pperson->name, &pperson->sex, &pperson->age); } | cs |
C/C++ 언어 구조체 템플릿은 함수 외부 변수는 함수 내부 선언
'C,C++ > 예제' 카테고리의 다른 글
| C/C++ 언어 중첩된 구조체의 초기화와 참조 방법에 대한 예제 프로그래 (0) | 2016.06.14 |
|---|---|
| C/C++ 언어 구조체 변수의 인자 전달 이해를 위한 예제 프로그램 (0) | 2016.06.14 |
| C/C++ 언어 비트 필드 참조 이해를 위한 예제 프로그램 (0) | 2016.06.10 |
| C/C++ 언어 패딩을 이용한 입력 정수의 최상위 비트와 최하위 비트의 값을 구하는 예제 프로그램 (0) | 2016.06.10 |
| C/C++ 언어 union(공용체)를 이용한 예제 프로그램 (0) | 2016.06.10 |