No values are printed out during the implementation of the sequence table. Where is the problem?

-sharpinclude <stdio.h>
-sharpinclude <stdlib.h>

-sharpdefine LIST_INIT_SIZE 100
-sharpdefine LISTINCREMENT 10

-sharpdefine OK 0
-sharpdefine error -1
-sharpdefine OVERFLOW -2

typedef int ElemType;

typedef struct _SqList
{
    ElemType *elem;
    int length;        //
    int listsize;    //
}SqList,*pSqList;

//
int addcapacity(SqList *sqlist)
{
    ElemType *newbase;    //
    newbase = (ElemType *)malloc((sqlist->listsize + LISTINCREMENT) * sizeof(ElemType));
    if (newbase == NULL)
        exit(OVERFLOW);
    sqlist->elem = newbase;
    sqlist->listsize += LISTINCREMENT;
    return OK;
}

//
int InitList_sq(SqList *sqlist)
{
    if (sqlist == NULL)
        return error;
    //
    sqlist->elem = (ElemType *)malloc(LIST_INIT_SIZE * sizeof(ElemType));
    if (!sqlist->elem)
        exit(OVERFLOW);
    sqlist->length = 0;
    sqlist->listsize = LIST_INIT_SIZE;
    return OK;
}

//inewelem
int ListInsert(SqList *sqlist, int i, ElemType newelem)
{
    if (sqlist == NULL || i<1 || i>sqlist->length + 1)
    {
        return error;
    }
    if (sqlist->length > sqlist->listsize)    //
    {
        if (addcapacity(sqlist) != OK)
            return OVERFLOW;
    }
    //ii
    for (int j = sqlist->length; j >= i; j--)
        sqlist->elem[j] = sqlist->elem[j - 1];
    sqlist->elem[i - 1] = newelem;
    sqlist->elemPP;
    return OK;
}

//
void Print_list(SqList *sqlist)
{
    int i;
    for (i = 0; i < sqlist->length; iPP)
        printf("%d  ", sqlist->elem[i]);
    printf("\n");
}

int main()
{
    SqList L;
    InitList_sq(&L);

    for (int i = 0; i < 10; iPP)    //0-9
    {
        ListInsert(&L, i + 1, i);
    }
    Print_list(&L);
    return 0;
}

was supposed to print out 0-9, but didn"t output any value? Which part of this link has gone wrong?

C
Mar.04,2021

-sharpinclude <stdio.h>
-sharpinclude <stdlib.h>

-sharpdefine LIST_INIT_SIZE 100
-sharpdefine LISTINCREMENT 10

-sharpdefine OK 0
-sharpdefine error -1
-sharpdefine OVERFLOW -2

typedef int ElemType;

typedef struct _SqList
{
    ElemType *elem;
    int length;        //
    int listsize;    //
}SqList,*pSqList;

//
int addcapacity(SqList *sqlist)
{
    ElemType *newbase;    //
    newbase = (ElemType *)malloc((sqlist->listsize + LISTINCREMENT) * sizeof(ElemType));
    if (newbase == NULL)
        exit(OVERFLOW);
    sqlist->elem = newbase;
    sqlist->listsize += LISTINCREMENT;
    return OK;
}

//
int InitList_sq(SqList *sqlist)
{
    if (sqlist == NULL)
        return error;
    //
    sqlist->elem = (ElemType *)malloc(LIST_INIT_SIZE * sizeof(ElemType));
    if (!sqlist->elem)
        exit(OVERFLOW);
    sqlist->length = 0;
    sqlist->listsize = LIST_INIT_SIZE;
    return OK;
}

//inewelem
int ListInsert(SqList *sqlist, int i, ElemType newelem)
{
    if (sqlist == NULL || i<1 || i>sqlist->length + 1)
    {
        return error;
    }
    if (sqlist->length > sqlist->listsize)    //
    {
        if (addcapacity(sqlist) != OK)
            return OVERFLOW;
    }
    //ii
    for (int j = sqlist->length; j >= i; j--)
        sqlist->elem[j] = sqlist->elem[j - 1];
    sqlist->elem[i - 1] = newelem;
    //TODO
    // sqlist->elemPP;
    sqlist->length PP;
    return OK;
}

//
void Print_list(SqList *sqlist)
{
    int i;
    for (i = 0; i < sqlist->length; iPP)
        printf("%d  ", sqlist->elem[i]);
    printf("\n");
}

int main()
{
    SqList L;
    InitList_sq(&L);

    for (int i = 0; i < 10; iPP)    //0-9
    {
        int result =  ListInsert(&L, i + 1, i);
        printf("%d",result);
    }
    Print_list(&L);
    return 0;
}

Please see the TODO section

Menu