I have two structures as shown below
struct server{
// some members
};
struct msg{
struct server* servers;
};
Then I do this.
struct msg msg1;
struct server s1,s2;
msg1.servers = (struct server *)malloc(2*sizeof(struct server));
msg1.servers[0] = &s1; // compilation error
msg1.servers[1] = &s2; // compilation error
This code does not compile and giving the following error : incompatible types when assigning to type ‘struct server’ from type ‘struct server *’.
What am I doing wrong?