====== Parallele Programmierung SS15 ====== * [[info:java|Java tips]] * [[info:eclipse_cheat_sheet|Eclipse tricks]] ===== Class 12 ===== Slides: [[http://people.inf.ethz.ch/gerbesim/teaching/pprog15/index.html]] Danke an Simon G.! ===== Class 10 ===== #include #include struct node { int value; struct node *next; }; void insert(struct node *list, struct node *element) { element->next = list->next; list->next = element; } void print(struct node *e) { printf("e->value=%d\n", e->value); } void apply(void (*f)(struct node *), struct node *list) { while (list) { f(list); list = list->next; } } int main() { int i; struct node list; list.value = 99999; list.next = NULL; for (i = 1; i <= 10; i++) { struct node *element = malloc(sizeof(struct node)); if (element == NULL) { return 1; } element->value = i << 2; insert(&list, element); } struct node *current = &list; /* while (current) { printf("%d ", current->value); current = current->next; } printf("\n"); */ apply(&print, &list); current = list.next; while (current) { printf("%d ", current->value); struct node *n = current; current = current->next; free(n); } printf("Hello world!\n"); return 0; }