aboutsummaryrefslogtreecommitdiff
path: root/sem3/algo/mm2/linked/main.c
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-10-12 16:26:42 +0200
committerJulian T <julian@jtle.dk>2020-10-12 16:54:48 +0200
commit4e05a55e373bd315e721d534a1711fec4c0054c5 (patch)
tree4fc0141760c2730ed79aaa4c7aa60ea45cc66cc0 /sem3/algo/mm2/linked/main.c
parentb7f9cf43c8a9ab3400cbb30d5e1cadb0c6c2cf23 (diff)
Moved to linux kernel inspired clang-format
Diffstat (limited to 'sem3/algo/mm2/linked/main.c')
-rw-r--r--sem3/algo/mm2/linked/main.c59
1 files changed, 29 insertions, 30 deletions
diff --git a/sem3/algo/mm2/linked/main.c b/sem3/algo/mm2/linked/main.c
index 6f4eb6a..8637796 100644
--- a/sem3/algo/mm2/linked/main.c
+++ b/sem3/algo/mm2/linked/main.c
@@ -4,44 +4,43 @@
void list_print(node_t *root)
{
- int index = 0;
- /* Loop through notes and print them */
- while ( root != NULL ) {
- /* Print a value */
- printf("%d: %d\n", index++, root->val);
+ int index = 0;
+ /* Loop through notes and print them */
+ while (root != NULL) {
+ /* Print a value */
+ printf("%d: %d\n", index++, root->val);
- /* Next value */
- root = root->next;
- }
+ /* Next value */
+ root = root->next;
+ }
}
/* Remove node */
int main()
{
-
- /* Do some stuff */
- llist_t list;
- llist_init(&list);
+ /* Do some stuff */
+ llist_t list;
+ llist_init(&list);
- llist_append(&list, 11); // 0
- llist_append(&list, 22); // 1
- llist_append(&list, 33); // 2
- llist_append(&list, 44); // 3
- llist_append(&list, 89); // 4
- llist_append(&list, 12); // 5
- llist_append(&list, 2); // 6
- llist_append(&list, 1); // 7
- llist_append(&list, 7); // 8
- llist_append(&list, 232);// 9
+ llist_append(&list, 11); // 0
+ llist_append(&list, 22); // 1
+ llist_append(&list, 33); // 2
+ llist_append(&list, 44); // 3
+ llist_append(&list, 89); // 4
+ llist_append(&list, 12); // 5
+ llist_append(&list, 2); // 6
+ llist_append(&list, 1); // 7
+ llist_append(&list, 7); // 8
+ llist_append(&list, 232); // 9
- list_print(list.root);
- printf("%d\n", llist_get(&list, 5));
- llist_pop(&list, 9);
- printf("%d\n", llist_get(&list, 7));
+ list_print(list.root);
+ printf("%d\n", llist_get(&list, 5));
+ llist_pop(&list, 9);
+ printf("%d\n", llist_get(&list, 7));
- list_print(list.root);
+ list_print(list.root);
- while ( list.len ) {
- printf("Popped %d\n", llist_pop(&list, 0));
- }
+ while (list.len) {
+ printf("Popped %d\n", llist_pop(&list, 0));
+ }
}