function pointers and callbacks

This commit is contained in:
2026-06-15 21:09:46 +02:00
parent 3b7c3fcbd0
commit f5605fd3ec
21 changed files with 1927 additions and 122 deletions
+53
View File
@@ -0,0 +1,53 @@
#ifndef BROLANG_RECORDS_H
#define BROLANG_RECORDS_H
typedef struct Pair {
int left;
int right;
} Pair;
typedef struct Triple {
int first;
int second;
int third;
} Triple;
typedef struct Floats {
float x;
float y;
} Floats;
typedef struct Large {
long values[3];
} Large;
typedef struct Nested {
Pair pair;
int tail;
} Nested;
typedef struct Arrays {
int values[3];
} Arrays;
typedef union Choice {
long integer;
double decimal;
} Choice;
typedef struct Forward Forward;
struct Forward {
int value;
};
Pair echo_pair(Pair value);
Triple echo_triple(Triple value);
Floats echo_floats(Floats value);
Large echo_large(Large value);
Nested echo_nested(Nested value);
Arrays echo_arrays(Arrays value);
Choice echo_choice(Choice value);
Forward echo_forward(Forward value);
int verify_records(Pair pair, Triple triple, Floats floats, Large large, Nested nested, Arrays arrays, Choice choice);
#endif