Skip to content

Instantly share code, notes, and snippets.

@aweimeow
Created October 22, 2014 12:50
Show Gist options
  • Save aweimeow/ad5e03c8252ee19ea66c to your computer and use it in GitHub Desktop.
Save aweimeow/ad5e03c8252ee19ea66c to your computer and use it in GitHub Desktop.
#include <iostream>
#include <cstdlib>
#include <stack>
#include <queue>
#define GET_ADDR (node *)malloc(sizeof(node))
#define layer_one(a) (*first[a].ptr)
#define layer_two(a) (*(*first[a].ptr).ptr)
using namespace std;
typedef struct whole
{
int value;
struct whole* ptr;
}node;
node first[11];
void init()
{
first[0].ptr = GET_ADDR;
layer_one(0).value = 11;
layer_one(0).ptr = GET_ADDR;
layer_two(0).value = 4;
layer_two(0).ptr = NULL;
first[1].ptr = GET_ADDR;
layer_one(1).value = 3;
layer_one(1).ptr = GET_ADDR;
first[2].ptr = GET_ADDR;
layer_one(2).value = 11;
layer_one(2).ptr = NULL;
}
int main()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment