/example.c Secret
Created
September 12, 2016 17:06
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef struct{ | |
int count; | |
} base; | |
typedef struct{ | |
base root; | |
int multiplier; | |
} leaf; | |
root* leaf_new(int multiplier){ | |
leaf* l = malloc(sizeof(leaf)); | |
l->root.count = 0; | |
l->multiplier = multiplier; | |
return &l->root; | |
} | |
void leaf_set_multiplier(root* r, int multiplier){ | |
leaf* l = container_of(r, leaf, root); | |
l->multiplier = multiplier; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment