You are defining the struct ID member as
char ID[5];
When you use NuevoPtr->ID
(without subscripts) in an expression, what you really get is the memory address of the beginning of the array . Since the array memory is in a fixed position, you simply can not assign it a new value.
If you want to change values, you will have to do so by specifying the indexes
NewPtr-> ID [0] = id;
If you had defined ID as a pointer ( char *ID
), you could assign it the memory address that pointer would point to.
Additionally, you are trying to assign a char
to what is an array of 5 positions. Dont have much sense; normally what you would expect is that the value you assign is compatible with the variable you assign to (although, as I explained earlier, in the case of arrays, even if they were of the same type, it would work).
For example, it would be more logical to do:
void crear(NodoE **inicioptr,char id[5]) { // también vale char *id
...
for (int i = 0; i < 5; i++) {
NuevoPtr->ID[i] = id[i];
}
}
or, if the values are strings ending in NULL (recommended)
strcpy(NuevoPtr->ID, id);