Hey I was wondering if I could get some help on this. I have an array that was given to me like this:
char **indexArray;
And I was told to add to the array like this:
indexArray[recCount++]=root->data;
recCount isn't important, but essentially, when I do this, I tried this:
printf(indexArray[recCount]);
printf(root->data);
Yet for some reason, the output is this:
ðy
test
Anyone know why?
Edit: @MikeCAT My node setup is as follows:
numNodes += 1;
struct bNode *node = (bNode *) malloc(sizeof(bNode));
node->data = data;
node->left = NULL;
node->right = NULL;
printf(node->data); #prints the data I want so this works just fine
return node;
}
Then I do something along the lines of:
bNode root = makeNode("test")
then I do this:
indexArray[recCount++]=root->data;
Yet when I do this:
printf("%s", indexArray[0]);
I either get some random character, (null), or just a blank line.