include stdio include conio define MAX 10 struct Stack int fix char ma

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <conio.h>
#define MAX 10
struct Stack
{
int fix;
char mas[MAX];
};
void clean()
{
Stack *s;
s->fix=-1;
}
int empty(Stack *whish)
{
if (whish->fix==0) return(0);
else return(1);
}
void instack(Stack *kuda,char what)
{
if (kuda->fix!=MAX)
{
kuda->mas[kuda->fix]=what;
kuda->fix++;
}
}
int outstack(Stack *otkuda)
{
otkuda->fix--;
return(otkuda->mas[otkuda->fix]);
}
void printstack(Stack *otkuda)
{ char mas[MAX];
int n;
n=MAX;
for(n;n>=0;n--)
{
printf("%c",mas[n]);
otkuda->fix--;
}
}