64 lines
856 B
C
64 lines
856 B
C
#include <stdarg.h>
|
|
#include <stdbool.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
|
|
struct T {
|
|
bool a;
|
|
uint8_t b;
|
|
};
|
|
|
|
enum Shape_Tag {
|
|
Circle,
|
|
Rectangle,
|
|
};
|
|
|
|
struct Circle_Body {
|
|
double radius;
|
|
};
|
|
|
|
struct Rectangle_Body {
|
|
double width;
|
|
double height;
|
|
};
|
|
|
|
struct Shape {
|
|
enum Shape_Tag tag;
|
|
union {
|
|
struct Circle_Body circle;
|
|
struct Rectangle_Body rectangle;
|
|
} body;
|
|
};
|
|
|
|
enum BTree_Tag {
|
|
Leaf,
|
|
Fork,
|
|
};
|
|
|
|
struct Leaf_Body {
|
|
int64_t value;
|
|
};
|
|
|
|
struct Fork_Body {
|
|
const struct BTree *left;
|
|
const struct BTree *right;
|
|
};
|
|
|
|
struct BTree {
|
|
enum BTree_Tag tag;
|
|
union {
|
|
struct Leaf_Body leaf;
|
|
struct Fork_Body fork;
|
|
} body;
|
|
};
|
|
|
|
void hello(const char *c);
|
|
|
|
void hello_struct(struct T t);
|
|
|
|
void hello_shape(struct Shape s);
|
|
|
|
__attribute__((const)) int64_t add(int64_t a, int64_t b);
|
|
|
|
int64_t sum_tree(struct BTree t);
|