#include <stdio.h>
#include <stdlib.h>
#include "string.h"
#define MAXLEN 5
struct str *talloc(void);
struct str *GetList(struct str *q,char *word);
struct str{
    char word[6];
    struct str *next;
    };
int main()
{
    struct str *list;
    list=NULL;

    char word[6];
    FILE *file;
    file=fopen("Test.txt","r");
    while (fgets(word,5,file)){
        printf("%s",word);
        list=GetList(list,word);

    }
    printf("\n");
    prin(list);
    return 0;
}

struct str *GetList(struct str *q, char *word){
    if (q==NULL){
        q = talloc();
        q->next=NULL;
        strcpy(q->word,word);
        return q;
    }
    q->next=GetList(q->next,word);
    return q;
}

struct str *talloc(void){
    return (struct str *)malloc(sizeof(struct str));
}

void prin(struct str *q){
    printf("%s",q->word);
    if(q->next!=NULL);
        prin(q->next);
}