I'm having a problem with this code. Can you explain me why this is not working:
#include <stdio.h>
#include <stdlib.h>
typedef struct NODE {
int value;
struct NODE *next;
} Node;
int main(void) {
Node *root = NULL, *connector;
int n;
printf("Enter a series of number: ");
for(;;) {
scanf("%d", &n);
if(n == 0)
break;
connector = malloc(sizeof(Node));
connector->value = n;
if(root == NULL) {
root = connector;
root->next = NULL;
}
connector = connector->next;
}
connector->next = NULL;
connector = root;
while(connector->next != NULL) {
printf("%d\n", connector->value);
connector = connector->next;
}
}