Originally Posted by yahoosam
that's the thing i am asking..
as i declare two distinct structure,but i need that the member of "server1" should refer "server2"
that is any modification in "server1->agent" should reflect in "server2->agent" as well
This is analogous to having two variables, of type int, called 'i' and 'j' and wishing for both to have the same value. The only way I know to accomplish that is two either set these variable to the same value, or set the first to a value, then the second equal to the first. Do you get what I'm driving at?
int i, j;
i = 5;
j = 5;
/* or *
i = 5;
j = i;
The same is going to apply to your structures. If you declare a variable of type struct server1 and start populating it, you will need to do something similar with the variable of struct server2.
If you are going to have basically identical structures, then why not just declare one type of structure, and then have two variables of that same type? For example:
struct Server* next;
struct Server srv1;
struct Server* srv2 = &srv1;
With the code above, each time srv1 is manipulated, srv2 will point to the same region.