C programming: Exc bad access - struct array.

Hello

I am stuck with this latest problem, hope someone can help me. Thank you very much in advance.

=== CODE STARTS ===
struct nodes {
int numberStored;
struct nodes *left;
struct nodes *right;
} numbers[10];


for (i=0; i < 10; i++)
{
theFunction(numbers[i].numberStored,numbers[i+1].numberStored,&numbers);
}

void theFunction(int top,int bottom,struct nodes *numbersF[])
{
(*numbersF[0]).numberStored = 20; /// <<<< ERROR HERE!
}
=== CODE ENDS ===

This is where I get exc bad access. I am not certain what the problem is, hope someone can help.

Thanks
cnewey
Try

theFunction(numbers[i].numberStored,numbers[i+1].numberStored,numbers);
You are accessing the array out of bounds. (last iteration of the loop)
Also there is no need for the extra level of indirection. http://www.cplusplus.com/doc/tutorial/arrays/ (arrays as parameters)

Side note: It should be an easier way for posting code. Especially considering that this is a programming forum.
Thank you Moschops and ne555
Topic archived. No new replies allowed.