Hello,
I need to assign a value of the member aaa->myhouse[co1].id to aaa->myflat[co1].id.
myhouse and myflat are both arrays of structures within the structure aaa. They contain different members, but id is a member that they both contain.
Both structures myflat and myhouse had already been initialised before this.
I tried
aaa->myflat[co1].id=aaa->myhouse[co1].id;
but when compiling, I get an error saying: " error: incompatible types when assigning to type to 'char[5]' from type 'char*'.
From everything I've read about structures, I thought that using "->" would give the value of "id" and not the address of "id".
What do I need to do to get the value of "id" and not the pointer, ie char[5] type and not char* type?
Also, I don't understand why on the left side the expression is read as the value of id, and on the right side it is not. Is there a different way of accessing structure members whether you want to copy the values from them or assign the values to them?
These are all the variables I am using:
struct city *aaa
struct house *myhouse
struct flat *myflat
char id[5]
int co1
Thanks!