- 228 名前:aho mailto:sage [2007/11/10(土) 21:34:14 ]
- >>215
struct person{ char name[20]; //char*では'q'の影響を受けるため int age; struct person* next; }; struct person* addList(char* name, int age, struct person* head){ struct person* list; /* メモリ確保 */ if((list = (struct person*)malloc(sizeof(struct person))) == NULL){ printf("malloc error!\n"); return NULL; } strcpy(list->name, name); list->age = age; list->next = head; head = list; return head; }
|

|