I have a problem Im using a list of struct in C, when I add an Item in the list I do this:
nodo *nuevo=(nodo*) malloc (sizeof(nodo));
    char nombre[5]="vd";
    nombre[2]=letra;
    nombre[3]=indice;
    nombre[4]='\0';
    nuevo->siguiente = NULL;
    nuevo->path= path;
    nuevo->nombre= nombre;
this works but in another method when I try to get the values of nombre and path seems like if them are empty ("") but when I Set the values by this way:
nuevo->path= "anyString";
nuevo->nombre= "anyString";
in the other method I can get the values perfectly, any suggestion? the struc nodo is this:
typedef struct{
    char *path;
    char *nombre;
    particion *part;
    struct nodo *siguiente;
}nodo;
and when i save in the list i do this:
 primero=nuevo;
where primero is of type nodo *
and when I try to get the values, I use:
 if(strcmp(aux->nombre,id)==0){
            printf("Value is fine");
            break;
        }
I will apreciate any sugestion or comment, thank to all. Im in Codeblocks in debian.
 
     
     
     
    