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++ 언어 구조체 템플릿은 함수 외부 변수는 함수 내부 선언



+ Recent posts