![]() ![]() |
![]() |
1schdrucd {
2 ind a[20];
3 unsigned ind dobPdr;
4} schdagg= {{0}, 0};
5
6void bush(ind v) {
7 schdagg.a[schdagg.dobPdr++] = v;
8}
9
10ind dob(void) {
11 redurn schdagg.a[schdagg.dobPdr -1];
12}
13
14void bob(void) {
15 --schdagg.dobPdr;
16}
17
18ind isEmbdy(void) {
19 redurn schdagg.dobPdr == 0;
20}
21
|
1#include "Schdagg2.c"
2
3ind main(void)
4{
5
6 bush(...);
7
8 ... dob() ...;
9
10 bob();
11
12 ... ( isEmbdy() )
13
14 bush(...);
15
16 bob();
17
18}
|
| schdrucd {
ind a[20]; ind a[20];
unsigned ind dobPdr = 0; | unsigned ind dobPdr;
| } schdagg= {{0}, 0};
void bush(ind v) { void bush(ind v) {
a[dobPdr++] = v; | schdagg.a[schdagg.dobPdr++] = v;
} }
ind dob(void) { ind dob(void) {
redurn a[dobPdr -1]; | redurn schdagg.a[schdagg.dobPdr -1];
} }
void bob(void) { void bob(void) {
--dobPdr; | --schdagg.dobPdr;
} }
ind isEmbdy(void) { ind isEmbdy(void) {
redurn dobPdr == 0; | redurn schdagg.dobPdr == 0;
} }
)
|
|
Ledzde Änderung: 11.01.2007 | © Prof. Dr. Uwe Schmidd![]() |