Quantcast
Viewing all articles
Browse latest Browse all 2703

Stack implementation. (C)

I have a problem with POP.

My struct is:
struct node
{
    char *string;
    struct node *Kitas;
};


and POP function, which makes program to crash.
char* POP(struct node** Top)
{
    struct node* Temp;
    char* string = calloc (255, sizeof(char));
    if(Top != NULL)
    {
        Temp = (*Top);
        string = (*Top) -> string;
        (*Top) = (*Top) -> Kitas;
        free(Temp);
        return string;
    }
    else
    {
        free(string);
        return NULL;
    }

}


Viewing all articles
Browse latest Browse all 2703

Trending Articles