C/C++の宿題を片づけます 49代目
■ このスレッドは過去ログ倉庫に格納されています
0757デフォルトの名無しさん
2005/09/06(火) 21:53:48#include <stdio.h> #include <malloc.h> #include <string.h>
struct MJlist {
char name [20]; int homerun;
struct MJlist *pointer;
};
int main (void){
struct MJlist *hd,*p1,*p2; int sum =0;
p2=(struct MJlist*)malloc(sizeof(struct MJlist));
strcpy(p2->name,"ICHIRO");
p2->homerun=10;
p2->pointer=NULL;
p1=(struct MJlist*)malloc(sizeof(struct MJlist));
strcpy(p1->name,"MATUI");
p1->homerun=15;
p1->pointer=NULL;
hd->pointer=p1;
p1->pointer=p2;
hd=(struct MJlist*)malloc(sizeof(struct MJlist));
strcpy(hd->name,"Nomo");
hd->homerun=5;
hd->pointer=NULL;
}
■ このスレッドは過去ログ倉庫に格納されています