#include #define MAXPOINTS_BASE 256 #define MAXPOINTS_LLEN (MAXPOINTS_BASE / (8 * sizeof(short int))) struct treenode { unsigned long int path_dist; unsigned short int path_point; unsigned short int path_forkn; unsigned short int path_forks[MAXPOINTS_LLEN]; struct treenode *p_parent; struct listcell *p_chlist; }; struct listcell { struct treenode *p_node; struct listcell *p_prev; struct listcell *p_next; }; void rmchlist(struct listcell *p_chlist) { /* This will free the children list */ } void rmbranch(struct treenode *p_branch) { struct listcell *p_chcell; p_chcell = p_branch->p_chlist; while(p_chcell->p_node) { rmbranch(p_chcell->p_node); p_chcell = p_chcell->p_next; } rmchlist(p_branch->p_chlist); free(p_branch); } int getbit(int data, int bpos) { return((data >> bpos) & 1); } int main(int argc, char *argv[]) { unsigned long int i; for (i=0; i<8; i++) { printf("%i", getbit(0xD2, i)); } printf("\n"); struct listcell list; list.p_node = calloc(1, sizeof(struct treenode)); list.p_prev = 0; list.p_next = 0; list.p_node->path_point = 1; printf("%i\n", sizeof(*list.p_node)); printf("%i\n", sizeof(struct treenode)); printf("%i\n", sizeof(list.p_node->path_point)); return 0; }