I have a struct like this:
struct node {
int state[9];
};
typedef struct node Node;
In the beginning of my code, I initialize it with some state. Then, I generate possible sucessors to this state, based on the ZERO location, for example:
case(7):
printf("Before generating sucessor 2:\n");
for(i=0;i<9;i++) printf("%d,", n->state[i])
suc2->state[7] = n->state[6];
suc2->state[6] = 0;
printf("After generating sucessor 2:\n");
for(i=0;i<9;i++) printf("%d,", n->state[i])
break;
The case above is in a function that generate possible sucessors states. And "n" is the node I receive: expand(Node* n);
My problem is: the n state is different after I generate sucessor 2. And I cant understand why, since i'm only changing successor 2 state.
What could be causing this?
nandsuc2point to the same struct