当我在主目录中调用printList函数时,它甚至不会打印出所有值
值在那里(我在printList函数中手动检查了)

void printList(listNode *start)
{
    listNode *currentPosition = start->next;


    threadList *t;
    t= currentPosition->tList->next;

    cList *c;
    c = currentPosition->tList->next->cpuList->next;

    if (currentPosition == NULL)
    {
        printf("list is empty\n");
    }
    else
    {
        while (currentPosition != NULL)
        {
            printf("process #: %d # of thread: %d\n",currentPosition->processNumber,currentPosition->numThread);

            while (t != NULL)
            {

                printf("thread #: %d Arrival time: %d # CPU: %d\n",t->threadNumber,t->arrivalTime,t->numCPU);


                while (c != NULL)
                {

                    printf("Burst #: %d CPU Time: %d io Time: %d\n",c->cNum,c->cpuTime,c->ioTime);

                    c=c->next;
                }


                t=t->next;
            }
            currentPosition = currentPosition->next;
        }
    }
}


我所有链接列表的第一个节点是一个虚拟节点。
有人可以帮我弄清楚我要去哪里错吗?

最佳答案

printList中,您似乎最初是在设置tc,然后再也不更新它们。

如果你移动

t= currentPosition->tList->next;
c = currentPosition->tList->next->cpuList->next;


到里面

while (currentPosition != NULL) {


然后,我认为它将起作用(我没有编译器)。

10-04 20:51