Nostalgia…..and a long awaited comeback

Got bored, wanted to test my memory (and latent C skills):

#include 

typedef struct node {
        char* data;
        struct node* next;
}* NODE;

int main()
{

        NODE root = NULL;
        NODE tail = NULL;

        root = (NODE) malloc(sizeof(struct node));
        tail = (NODE) malloc(sizeof(struct node));

        root->data = "hello";
        tail->data = "world";

        root->next= tail;
        tail->next = NULL;

        // display the contents of the linked list
        NODE cur = root;
        for(;cur != NULL; cur= cur->next)
        {
                printf("%s ", cur->data);
        }

        free(root);
        free(tail);

        printf("\n");

        return 0;
}

And it worked. First time around. Nice! 😉

Nostalgia…..and a long awaited comeback