diff options
author | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-11 03:56:01 +0000 |
---|---|---|
committer | Fudgerboy <91767657+Fudgerboy@users.noreply.github.com> | 2024-04-11 03:56:01 +0000 |
commit | 5b5d40ebef857ce5dbd9627467aec1b6d58d75e7 (patch) | |
tree | c437d7c7ccec23b16345e4d2a4fe39a473d73db7 /wk5/lect/list2.c | |
parent | 68bfe1a1c32b981a1403ca5a7168162aba3cd4d3 (diff) |
Wed, Apr 10, 2024, 8:56 PM -07:00
Diffstat (limited to 'wk5/lect/list2.c')
-rw-r--r-- | wk5/lect/list2.c | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/wk5/lect/list2.c b/wk5/lect/list2.c deleted file mode 100644 index de94253..0000000 --- a/wk5/lect/list2.c +++ /dev/null @@ -1,42 +0,0 @@ -#include <cs50.h> -#include <ctype.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <math.h> - -typedef struct node -{ - int number; - struct node *next; -} node; - -int main(int argc, char *argv[]) -{ - node *list = NULL; - - for (int i = 1; i < argc; i++) - { - int number = atoi(argv[i]); - - node *n = malloc(sizeof(node)); - if (n == NULL) - { - // free memory - return 1; - } - - n->number = number; - n->next = list; - list = n; - } - - // Print whole list - node *ptr = list; - while (ptr != NULL) - { - printf("%i\n", ptr->number); - ptr = ptr->next; - } -} |