【发布时间】:2014-09-19 20:41:15
【问题描述】:
#include <stdio.h>
#define MAX 3 // students in class
#define LEN 20 // max lengths stydent's name
typedef struct {
char name[LEN];
int am;
float tv;
}student;
void read (student board[]) { //this function should fill the board of structs
int i;
for (i=0; i<MAX; i++) {
printf("\n give student's name");
scanf ("%s",&board[i].name);
}
}
void read (student board[]);
int main (void) {
student class[MAX];
read (class);
return 0;
}
当我尝试编译它时,我得到了这个错误
let2.c:15:3:警告:格式“%s”需要“char ”类型的参数,但参数 2 的类型为“char ()[20]”[-Wformat= ]
let2.c:15:3:警告:格式“%s”需要“char ”类型的参数,但参数 2 的类型为“char ()[20]”[-Wformat=]
【问题讨论】: