Hi
I have the following code:
struct node{
int ID;
bool connected;
int *connectedTo[50];
int numConnectedTo;
int numMsgsRecieved;
int overwhelmed[20][20];
node *nxtNode;
};
void main(){
.
.
.
}
void createNetwork(node *headNode){
node * firstPivotNode = headNode;
node * secondPivotNode = headNode->nxtNode;
.
.
.
firstPivotNode->connectedTo[0] = secondPivotNode;
.
.
.
}
my problem is in "int *connectedTo[50]" in the struct.
As you can see I have created a linked list and i want the connectedTo array to store the address to x numbers (less than 50) of links. But it is not working. I guess the problem is that since the type of secondPivotNode is a node * I can't store it is "address" in an int array.
In fact I can't even do the following
int test = firstPivotNode;
which is wierd because I can do this:
cout << firstPivotNode;
and it prints the address where firstPivotNode is pointing to.
any possible suggestions?
Thanks
I have the following code:
struct node{
int ID;
bool connected;
int *connectedTo[50];
int numConnectedTo;
int numMsgsRecieved;
int overwhelmed[20][20];
node *nxtNode;
};
void main(){
.
.
.
}
void createNetwork(node *headNode){
node * firstPivotNode = headNode;
node * secondPivotNode = headNode->nxtNode;
.
.
.
firstPivotNode->connectedTo[0] = secondPivotNode;
.
.
.
}
my problem is in "int *connectedTo[50]" in the struct.
As you can see I have created a linked list and i want the connectedTo array to store the address to x numbers (less than 50) of links. But it is not working. I guess the problem is that since the type of secondPivotNode is a node * I can't store it is "address" in an int array.
In fact I can't even do the following
int test = firstPivotNode;
which is wierd because I can do this:
cout << firstPivotNode;
and it prints the address where firstPivotNode is pointing to.
any possible suggestions?
Thanks