I have this in my code:
#define MAXSTU 100
I then have this array:
char names_and_courses[MAXSTU][2][30];
So I was having the problem outlined above, couldn't find anywhere where I was trying to access elements past the end of my array anywhere like Matt suggested. Then I change MAXSTU to 50 and hey presto, problem solved. But why is this, perhaps somebody coukd let me know, thx.
Because when declaring an array like
array[50], its indexes are in the range
0..49.
array[50] = something could cause a GPF. [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal... once stated: methane@personal.ro
But I still dont see a problem. My array was initialised correctly.
So;
array[50] (indexes are 0..49)
and;
array[100] (indexes should be 0..99)
(No problem here, I understand this.)
And my loop should work with both array's regardless of their size. So why did I get a problem? I never have tried to write/use memory I didn't have. If that was the problem then surely the fact that it was changed from MAXSTU = 100 to MAXSTU = 50 but not changing the loop should make no difference and I would still be getting a general protection exception. But simply changing the value of MAXSTU from 100 to 50 solved it. Why?????????
Thx 4 your help BTW. Appreciated.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.