Problem in C programming


  • 0
    P

    how to write the function void minStackDestroy(MinStack *stack) ? why it's a RE when i write free in this function TAT ?

    and why when my creation function write

    stack -> size = 0;
    stack -> buff = (int *)malloc(maxSize * sizeof(int));
    stack -> minsize = 0;
    stack -> minbuff = (int *)malloc(maxSize * sizeof(int));
    

    it's ok but when I write

    stack -> size = 0;
    stack -> buff = (int *)malloc(maxSize * sizeof(int));
    stack -> minsize = 0;
    stack -> minbuff = (int *)malloc(maxSize * sizeof(int));
    stack -> buff = (int *)malloc(maxSize * sizeof(int));
    

    it cause a WA ?

    thank you for you help........


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.