问题补充:
#include
#include
#define all 2
#define LED sizeof(struct face)
struct face
{
float num[6];
struct face *next;
};
int main ()
{
FILE *fp;
if ((fp=fopen("1.txt","r"))==NULL)
printf("无法打开这个文件");
struct face *p,*head;
int a,b;
p=(struct face *)malloc(LED);
head=p;
//读取文件的内容
for (a=0;a
{
for (b=0;b<6;b++)
{
fscanf(fp,"%f",&p->num[b]);
}
p=p->next;
p=(struct face *)malloc(LED);
}
//输出链表的数据
for (a=0;a
{
for (b=0;b<6;b++)
{
printf("%f",head->num[b]);
}
printf("\n");
head=head->next;
}
}