Mấy bạn coi thử mình xài chỗ nào mà lỗi cứ hiện hoài:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
struct student
{
char holot[50];
char ten[10];
int mssv;
int diem;
};
void nhap( student sv[20],int n);
void xuat( student sv[20],int n);
int main(int argc, char *argv[])
{
int n;
struct student sv[20];
printf("Nhap so luong sinh vien: ");
scanf("%d", &n);
return 0;
}
/*ho ten , ma sinh vien va diem cua sinh vien */
void nhap(student sv[20],int n)
{
for(int i=0;i<n;i++)
{
printf("\n nhap vao ho lot :");
gets(sv[i].hoten);
printf("\n nhap vao lop :");
gets(sv[i].lop);
printf("\n nhap vao mssv:");
scanf("%d",&sv[i].mssv);
printf("\n nap vao diem trung binh");
scanf("%d",&sv.diem);
}
}
void xuat (student sv[20],int n)
{
for(int i=0;i<n;i++)
{
printf("\n ho ten :%c", sv[i].hoten);
printf("\n lop :%c", sv[i].lop);
printf("\n mssv:%c",sv[i].mssv);
printf("\n diem trung binh %d",&sv.diem);
}
}