I am getting this error message:
error: incompatible types when assigning to type 'Nombre {aka struct <anonymous>}' from type 'int':
nombre[0] = 'A'+(rand()%26);
The code:
typedef struct{
char nombre[9];
}Nombre;
Nombre* crearNombre(){
Nombre *nombre;
nombre = (Nombre*)malloc(9* sizeof(char));
nombre[0] = 'A'+(rand()%26);
for (int i=1; i<9; ++i){
if(i == 9){
nombre[i] = '\0';
}
else nombre[i] = 'a'+(rand()%26);
}
return nombre;
}
What does it mean and how can I fix it?