#include <stdio.h>
#include <string.h>
struct student{
char name[20];
int age;
};
//학생 정보를 저장하는 student 구조체를 정의합니다.
int main()
{
struct student student[3] = {{"김하하",17},{"박호호",19},{"최히히",18}};
//학생 3명의 정보를 저장할 student를 선언하며 값을 초기화합니다.
//김하하 17, 박호호 19, 최히히 18
for(int i = 0;i<3;i++){
printf("%s%d\n",student[i].name,student[i].age);
};
//세 학생의 정보를 차례대로 출력합니다. 각 학생의 정보는 줄내림으로 구분합니다.
return 0;
}
왜 이럴까요?
comment