It is not a good idea to use typedef when you make a linked list. Better with a struct.
Couldīt find your stack struct.
You need to have:
Code:
struct node
{
int x;
struct node*next;
};
struct stack
{
struct node*head;
};





void push(struct stack *s,int x)
{
struct node*new;
new=malloc(sizeof(struct node));
new->x=val;
new->next=s->head;
s->head=new;
}


int pop(struct stack *s)
{
int x;
if(s->head!=NULL)
{
tal=s->head->x;
struct node*e=s->head;
s->head=s->head->next;
free(e);
return x;
}
return 0;
}

Last edited by shabbir; 27Nov2009 at 09:12.. Reason: Code blocks