#include <Stdio.h>
#include <stdlib.h>
class student
{
int id;
char name[8];
char dept[4];
}
int main()
{
int a;
char b[8],c[4];
int i,j;
FILE *fp = fopen("StdList.txt","r+t");
if(fp==NULL)
{
printf("파일 안열림\n");
return 1;
}
scanf("%d",&i);
student *std;
std=(student *)malloc(sizeof(student)*i);
for(j=0;j<i;j++)
{
fscanf(fp,"%d",&a);
std[j].id=a; <<<<<<<<<<<<<<<<<<<<<<<<<<<----------------------이 부분이 지금 오류떠요
std[j]->id 라 해도 뜨고요 이유좀 알려주세요 ㅠㅠ
#include <stdlib.h>
class student
{
int id;
char name[8];
char dept[4];
}
int main()
{
int a;
char b[8],c[4];
int i,j;
FILE *fp = fopen("StdList.txt","r+t");
if(fp==NULL)
{
printf("파일 안열림\n");
return 1;
}
scanf("%d",&i);
student *std;
std=(student *)malloc(sizeof(student)*i);
for(j=0;j<i;j++)
{
fscanf(fp,"%d",&a);
std[j].id=a; <<<<<<<<<<<<<<<<<<<<<<<<<<<----------------------이 부분이 지금 오류떠요
std[j]->id 라 해도 뜨고요 이유좀 알려주세요 ㅠㅠ
무슨에러인지는 최소한 적어놔야 첨부터 라인을 안읽어도 되고 시간을 절약하겠지 않겠냐?