Home > Back-end >  Save the children!!!!! .exe 'has exited with code 0 (0 x0). Don't know what went wrong
Save the children!!!!! .exe 'has exited with code 0 (0 x0). Don't know what went wrong

Time:11-28

#include
#include
# include "list. H"


Typedef struct SNode
{
ElemType data;
Struct SNode * next;
} SNode, * Linkstack;


The status Initstack (Linkstack * s)
{
* s=(Linkstack) malloc (sizeof (SNode));
If (* s==NULL)
{
Printf (" allocation failure!" );
return ERROR;
}
(* s) - & gt; Next=NULL;
return OK;
}


Status Push Linkstack s, ElemType (e)
{
Linkstack p;
P=(Linkstack) malloc (sizeof (SNode));
If (p==NULL)
{
Printf (" allocation failure!" );
return ERROR;
}
P - & gt; data=https://bbs.csdn.net/topics/e;
P - & gt; Next=s - & gt; Next;
S - & gt; Next=p;
return OK;
}



Status of Pop (Linkstack s, ElemType * e)
{
Linkstack q;
If (s - & gt; Next==NULL)
{
Printf (" stack is empty!" );
return ERROR;
}
* e=s - & gt; Next - & gt; The data;
Q=s - & gt; Next;
S - & gt; Next=q - & gt; Next;
free(q);
return OK;
}


Int main ()
{
Linkstack s;
ElemType e;
Initstack (& amp; S);
For (e=0; E<5; E++)
Push (s, e);
Printf (" % d ", e);
return 0;
}

CodePudding user response:

Program does not have the output of the building Lord, called POP place?
The program belongs to the normal exit

CodePudding user response:

Is not this error, free is address, but I don't know where
  • Related