#include <stdio.h>
struct student //구조체 선언
{
char name[10];//이름 변수선언
int kor;//국어 변수선언
int eng;//영어 변수선언
int math;//수학 변수선언
int tot;//합계 변수 선언
double avg;//평균 선언
};
void Print_Out(struct student* st);//프린트 함수 선언
int main(void)
{
int i;
struct stu[5];//구조체의 배열 선언
for (i=0; i<6; ++i) //for문을 이용하여 함수 5번출력
Print_Out(&stu[i]); //함수 출력
}
struct stu={
{"Kim", 95, 95, 90, 280, 93.4},
{"Park", 90, 85, 90, 265, 88.4},
{"Lee", 95, 95, 95, 285, 95.0},
{"Hong", 85, 85, 90, 260, 86.7},
{"Oh", 85, 85, 85, 255, 85.0}
};//구조체 입력
void Print_Out(struct student* st)//포인터를 이용한 함수
{
printf("이름: %s 국어: %d 영어: %d 수학: %d 총점: %d 평균: %f\n",st->name, st->kor, st->eng, st->math, st->tot, st->avg); //포인터를 이용한 출력
}
일단 이렇게 프로그래밍 했는데요
>c:\users\sec\documents\visual studio 2008\projects\c\c\c.c(18) : error C2143: 구문 오류 : ';'이(가) '[' 앞에 없습니다.
1>c:\users\sec\documents\visual studio 2008\projects\c\c\c.c(20) : error C2065: 'stu' : 선언되지 않은 식별자입니다.
1>c:\users\sec\documents\visual studio 2008\projects\c\c\c.c(20) : error C2109: 첨자는 배열 또는 포인터 형식을 사용해야 합니다.
1>c:\users\sec\documents\visual studio 2008\projects\c\c\c.c(20) : error C2198: 'Print_Out' : 호출에 매개 변수가 너무 적습니다.
1>c:\users\sec\documents\visual studio 2008\projects\c\c\c.c(22) : error C2513: 'stu' : '=' 앞에 변수를 선언하지 않았습니다.
이런 오류가 뜨네요 ㅠㅠ