#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
struct HocSinh
{
char MSHS[10],Hoten[30];
float DiemToan,DiemAnh,DiemVan;
};
typedef struct HocSinh HOCSINH;
void Nhapthongtin(HOCSINH *x[],int n)
{
for(int i=0;i<n;i++)
{
printf("STT: %d",i);
fflush(stdin);
printf("\nNhap MSHS: ");
gets(x[i]->MSHS);
fflush(stdin);
printf("\nNhap Ho ten: ");
gets(x[i]->Hoten);
printf("\nDiem Toan: ");
scanf("%f",&x[i]->DiemToan);
printf("\nDiem Anh: ");
scanf("%f",&x[i]->DiemAnh);
printf("\nDiem Van: ");
scanf("%f",&x[i]->DiemVan);
printf("\n----------------------------------------");
}
}
void Xuatdulieu(HOCSINH *x[],int n)
{
for(int i=0;i<n;i++)
{
printf("STT: %d",i+1);
printf("\nMSHS: %s",x[i]->MSHS);
printf("\nHo ten: %s",x[i]->Hoten);
printf("\nDiem Toan: %.2f",x[i]->DiemToan);
printf("\nDiem Anh: %,2f",x[i]->DiemAnh);
printf("\nDiem Anh: %,2f",x[i]->DiemVan);
printf("\n----------------------------------------");
}
}
void main()
{
int n;
HOCSINH *x;
x = (HOCSINH*)malloc(n*sizeof(HOCSINH));
printf("\nNhap so luong HS: ");
scanf("%d",&n);
Nhapthongtin(x,n);
Xuatdulieu(x,n);
getch();
}
Lỗi error C2664: ‘Nhapthongtin’ : cannot convert parameter 1 from ‘HOCSINH *’ to ‘HOCSINH *[]’
error C2664: ‘Xuatdulieu’ : cannot convert parameter 1 from ‘HOCSINH *’ to ‘HOCSINH *[]’
Sữa lại như thế nào?