1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <assert.h>
// NAÏVE WAY - do not do it like this
//
// Wastes lots of space, and we don't know what kind of data a given
// node contains.
struct Node {
struct Node* next;
int as_int;
char* as_string;
struct Node* as_list;
int type; // YUK!!! 0→int 1→string 2→list
// DON'T USE MAGIC NUMBERS
};
/* vim: set tabstop=4 shiftwidth=4 fileencoding=utf-8 noexpandtab: */
|
© Copyright 2020 Alexander J. Quinn This content is protected and may not be shared, uploaded, or distributed.