C/C++の宿題を片付けます 99代目
at TECH
228:aho
07/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;
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
4817日前に更新/222 KB
担当:undef