why when i print the list it always misses the 1st line of input ?
here's my code:


struct list {
    char data;
    struct list * next;

typedef struct list item;

int main()
    item * curr, * head;
    char c;
    head = NULL;
        curr = (item *)malloc(sizeof(item));
        curr->data = c;
        curr->next = head;
        head = curr;
    curr = head;
        printf("%c", curr->data);
        curr = curr->next;
    return 0;

ok i've solved the issue by just making it add nodes at the end of the list instead,
and it worked fine that way.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.