summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/stack.c
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-20 15:09:10 +0200
committertylov <[email protected]>2023-07-20 15:12:29 +0200
commit900295256d825fc323149cd223c49787f32a3696 (patch)
tree6c79cf4209e3975bb6865e2940b9cb56ea469c73 /misc/examples/stack.c
parent224a04f7fa7549ed94d2a1415eb25829e39a7cca (diff)
downloadSTC-modified-900295256d825fc323149cd223c49787f32a3696.tar.gz
STC-modified-900295256d825fc323149cd223c49787f32a3696.zip
Moved examples to sub-directories. Added cotask1.c cotask2.c examples.
Diffstat (limited to 'misc/examples/stack.c')
-rw-r--r--misc/examples/stack.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/misc/examples/stack.c b/misc/examples/stack.c
deleted file mode 100644
index 6297fb6f..00000000
--- a/misc/examples/stack.c
+++ /dev/null
@@ -1,32 +0,0 @@
-
-#include <stdio.h>
-
-#define i_tag i
-#define i_capacity 100
-#define i_key int
-#include <stc/cstack.h>
-
-#define i_tag c
-#define i_key char
-#include <stc/cstack.h>
-
-int main(void) {
- cstack_i stack = {0};
- cstack_c chars = {0};
-
- c_forrange (i, 101)
- cstack_i_push(&stack, (int)(i*i));
-
- printf("%d\n", *cstack_i_top(&stack));
-
- c_forrange (i, 90)
- cstack_i_pop(&stack);
-
- c_foreach (i, cstack_i, stack)
- printf(" %d", *i.ref);
- puts("");
- printf("top: %d\n", *cstack_i_top(&stack));
-
- cstack_i_drop(&stack);
- cstack_c_drop(&chars);
-}