N
neo-saiya-jin
I have the following code:
struct nodeType
{
string value;
int arraySize;
nodeType **child;
};
int main()
{
int i = 0;
nodeType *node = new nodeType;
cin>>node->arraySize;
node->child = new nodeType*[node->arraySize];
node->child->value = "10";
cout<<node->child->value;
}
the above is just part of my program, I'm actually trying to construct
a tree dynamically by based on the data from file the main problems
I'm encountering now is that when I make the i as the condition
variable in a for loop, so that I can dynamically create and assign
the variable, my attempt to access the data later succeed only until
the first element in the array, attempt to access the element child[1]
and onwards will result in infinite loop.
struct nodeType
{
string value;
int arraySize;
nodeType **child;
};
int main()
{
int i = 0;
nodeType *node = new nodeType;
cin>>node->arraySize;
node->child = new nodeType*[node->arraySize];
node->child->value = "10";
cout<<node->child->value;
}
the above is just part of my program, I'm actually trying to construct
a tree dynamically by based on the data from file the main problems
I'm encountering now is that when I make the i as the condition
variable in a for loop, so that I can dynamically create and assign
the variable, my attempt to access the data later succeed only until
the first element in the array, attempt to access the element child[1]
and onwards will result in infinite loop.