What's the best approach to check if in a array of lists a single list is empty after I used calloc?

前端 未结 3 840
没有蜡笔的小新
没有蜡笔的小新 2021-01-26 09:12

Usually, when I use linked lists, I write:

struct node *startPtr = NULL;

so I check later if is it NULL, and if it is, it means that the list is

3条回答
  •  梦谈多话
    2021-01-26 09:40

    You can try to assign nextPtr to the same element or you can introduce a special global item which will mean an empty list.

提交回复
热议问题