#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct char_node *char_list;

struct char_node{
    char info;
    char_list next;
}char_node;

char_list makesNode(void);
char_list makesValueNode(char value);
char_list makesList(char nome[]);
void viewNode(char_list l);
void viewList(char_list l);

int main(){
    char nome[] = "Ugo";
    char_list nuovo = makesList(nome);
    if(nuovo != NULL)
        viewList(nuovo);
    return 0;
}

char_list makesNode(void){
    return (char_list)malloc(sizeof(struct char_node));
}

char_list makesValueNode(char value){
    char_list li = NULL;
    li = makesNode();
    li -> info = value;
    li -> next = NULL;
    return li;
}

char_list makesList(char nome[]){
    char_list nuovo;
    char_list head = NULL;
    int l = strlen(nome);
    l = l - 1;
    while(l >= 0 ){
        nuovo = makesValueNode(nome[l]);
        if(nuovo != NULL){
            nuovo -> next = head;
            head = nuovo;
            l = l - 1;
        }
    }
    return nuovo;
}

void viewNode(char_list l){
    printf("%c", l->info);
}

void viewList(char_list l){
    while(l != NULL){
        viewNode(l);
        l = l -> next;
    }
}
