Changeset 3fb7f5e for doc/generic_types/evaluation/c-stack.c
- Timestamp:
- Apr 14, 2017, 4:51:13 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 1504536, e3de500
- Parents:
- 3895b8b5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/c-stack.c
r3895b8b5 r3fb7f5e 8 8 9 9 struct stack new_stack() { 10 return (struct stack){ NULL }; 10 return (struct stack){ NULL }; /***/ 11 11 } 12 12 … … 15 15 struct stack_node* next = t->head; 16 16 while ( next ) { 17 *crnt = malloc(sizeof(struct stack_node)); 18 **crnt = (struct stack_node){ copy(next->value) }; 17 *crnt = malloc(sizeof(struct stack_node)); /***/ 18 **crnt = (struct stack_node){ copy(next->value) }; /***/ 19 19 crnt = &(*crnt)->next; 20 20 next = next->next; … … 39 39 40 40 void push_stack(struct stack* s, void* value) { 41 struct stack_node* n = malloc(sizeof(struct stack_node)); 42 *n = (struct stack_node){ value, s->head }; 41 struct stack_node* n = malloc(sizeof(struct stack_node)); /***/ 42 *n = (struct stack_node){ value, s->head }; /***/ 43 43 s->head = n; 44 44 }
Note: See TracChangeset
for help on using the changeset viewer.