Home > Back-end >  The basic operations of a stack, random number is why
The basic operations of a stack, random number is why

Time:09-26

#include
#include
Typedef struct Node
{
The int data;
Struct Node * next;
} the Node;
Typedef struct stack
{
Node * top;
int count;
} the stack;
Void Init (stack s)
{
S.t op=NULL;
S.c mount=0;

}
Int pop (stack s)
{
int a;
Node * p=(*) malloc (sizeof (Node));
p-> next=NULL;
P=s.t op;
A=s.t op - & gt; The data;
S.t op=p - & gt; next;
Free (p);
S.c mount -;
return a;

}
Void push (stack s, int a)
{
Node * p;
P=(*) malloc (sizeof (Node));
p-> data=https://bbs.csdn.net/topics/a;
p-> Next=s.t op;
S.t op=p;
S.c ount++;
}
Int gettop (stack s)
{
Int a=s.t op - & gt; The data;
}

Void main ()
{
Stack s; int i;
Init (s);
for(i=0; i<5; + + I)
Push (s, I);
for(i=0; i<5; + + I)
{
Int e=pop (s);
Printf (" % d ", e);
}


}

CodePudding user response:

What is a random number?

CodePudding user response:

Has been solved, there is no reference

CodePudding user response:

I didn't say understand, ha ha, understood your
  • Related