11/11/22 20:55:47.56
課題2 解答例
struct cell *makeNullList(void)
{
struct cell *list;
list = (struct cell*)malloc(sizeof(struct cell));
if (list == (struct cell*)NULL) {
fprintf(stderr, "makeNullList: can not allocate memory for new list.\n");
exit(1);
}
list->next = (struct cell*)NULL;
return list;
}
課題3 解答例
struct cell *nextCell(struct cell *target, struct cell *list)
{
struct cell *next = (struct cell*)NULL;
if (target != (struct cell*)NULL) {
next = target->next;
}
return next;
}