1

このコードをコンパイルしようとすると、エラー: 要求された非スカラー型への変換が表示されました。このエラーは次の行を参照しています:

func( record);

私のコードで何が間違っているかを知ることができますか?

#include <stdio.h>
#include <string.h>

struct student 
{
 int id;
 char name[30];
 float percentage;
};
void func(struct student record); 

int main() 
{

 struct student record[2];
 func( record);
 return 0;
 }     

 void func(struct student record[]) {
 int i;
 record[0].id=1;
 strcpy(record[0].name, "lembu");
 record[0].percentage = 86.5;


 record[1].id=2;
 strcpy(record[1].name, "ikan");
 record[1].percentage = 90.5;


 record[2].id=3;
 strcpy(record[2].name, "durian");
 record[2].percentage = 81.5;

 for(i=0; i<3; i++)
 {
     printf("     Records of STUDENT : %d \n", i+1);
     printf(" Id is: %d \n", record[i].id);
     printf(" Name is: %s \n", record[i].name);
     printf(" Percentage is: %f\n\n",record[i].percentage);
 }

}
4

5 に答える 5