1 year ago

#389232

test-img

JamesL_22

Bus error 10 for initialisation of my skip list

  1. how can I find the bus error 10 for the initiation process of my skip list???
    struct leapList *initSkipList(struct leapList *skipList[]) {
        int i;
        for (i=0;i<maximum_level;i++) {

               //this is likely to be the bus error, the breakpointbut how
               //can we find the error
                
                struct leapList* newHead = (struct leapList*)malloc(sizeof(struct leapList));
                if (NULL == newHead) {
                        printf(" Fail to applicate on the tail node\n");
                        return NULL;
                }
                newHead->data = -1-i;
                newHead->down = NULL;
                newHead->up = NULL;
                newHead->next = NULL;
                newHead->last = NULL;

                skipList[i] = newHead;
        }
        return *skipList;
}

c

linked-list

gdb

valgrind

doubly-linked-list

0 Answers

Your Answer

Accepted video resources