Here is the problem: there are members of a family that should be insert into tree but there are also their spounces that should insert into tree as separated nodes. The only common between original member and their spounces is that spounces must have the same children num, array with children ids, generation, children pointer which is the problem.
Member struct
Code:
typedef struct _Node
{
int ID;
char *Name;
int ParentID;
int Date_of_birth;
char *Place_of_birth;
int SpounceID;
int k;
int *ChildrenID;
int Generation;
struct Node *next_family;
struct Node *parent;
struct Node *spounce;
struct Node *children;
}Node;
If children pointer changes for a member i want to change and for the member's spounce.
I think the problem located in assignment in the beginning.
Here is where pointers assignment takes place, the rest assignment is ok, here is the problem. temp is the member of tree and newnode his/her spounce.
Code:
//If exists and able to accept spounce
if((temp!=NULL)&&(temp->SpounceID!=-1))
{
//Assign last values
temp->spounce=newnode;
newnode->spounce=temp;
newnode->ChildrenID=temp->ChildrenID;
newnode->children=temp->children; // <------Here
newnode->Generation=temp->Generation;
}
Thanks in advance.