正在输入联合体示例代码
This commit is contained in:
parent
8b87cff2ee
commit
62f0b69744
|
@ -0,0 +1,20 @@
|
|||
#include <stdio.h>
|
||||
|
||||
typedef enum {
|
||||
TYPE_INT,
|
||||
TYPE_FLOAT,
|
||||
TYPE_STRING,
|
||||
} VariantType;
|
||||
|
||||
struct Variant {
|
||||
VariantType type;
|
||||
union {
|
||||
int as_integer;
|
||||
float as_float;
|
||||
char *as_string;
|
||||
} data;
|
||||
};
|
||||
|
||||
typedef struct Variant Variant;
|
||||
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
# gcc $(pkg-config --cflags libbsd-overlay) hello.c -o hello $(pkg-config --libs libbsd-overlay)
|
||||
CFLAGS=-isystem /usr/include/bsd -DLIBBSD_OVERLAY -g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG $(OPTFLAGS)
|
||||
# CFLAGS=-isystem /usr/include/bsd -DLIBBSD_OVERLAY -g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG $(OPTFLAGS)
|
||||
CFLAGS=$(pkg-config --cflags libbsd-overlay) -g -O2 -Wall -Wextra -Isrc -rdynamic -DNDEBUG $(OPTFLAGS)
|
||||
|
||||
LDLIBS = -lbsd -lm
|
||||
LIBS=-ldl $(OPTLIBS)
|
||||
PREFIX?=/usr/local
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -22,3 +22,11 @@ RadixMap *RadixMap_create();
|
|||
void RadixMap_destroy(RadixMap *map);
|
||||
|
||||
void RadixMap_sort(RadixMap *map);
|
||||
|
||||
RMElement *RadixMap_find(RadixMap *map, uint32_t key);
|
||||
|
||||
int RadixMap_add(RadixMap *mao, uint32_t values);
|
||||
|
||||
int RadixMap_delete(RadixMap *map, RMElement *el);
|
||||
|
||||
#endif
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue