構造体

例文6

#include <stdio.h>
struct STUDENT{
  char *name;
  int age;
};

struct STUDENT reg(char *, int);
void say(struct STUDENT *);

int main(void){
  struct STUDENT taro = reg("TARO", 14);
  say(&taro);
  return 0;
}

struct STUDENT reg(char *name, int age){
  struct STUDENT student;
  student.name = name;
  student.age = age;
  return student;
}
void say(struct STUDENT *student){
  printf("%s -- %d\n", student->name, student->age);
}