ok, thanks for your help, ive fixed it now :D
I had declared it like this:
but when i reduced it to:Code:car car_details[300];
it worked.:)Code:car car_details[285];
Printable View
ok, thanks for your help, ive fixed it now :D
I had declared it like this:
but when i reduced it to:Code:car car_details[300];
it worked.:)Code:car car_details[285];
Thats one of those stange bugs that indicates a buffer overflow or uninitialized variables somewhere. I've once achieved something similar to this by using
without ever initalizing i. The bugs you get afterwards are strange and change when changing the program, sometimes they seem fixed but then they pop up again. Until you find the real cause.Code:for (i; i<10; i++) {
get some memory here
}
Salem might remember this.
> car car_details[285];
Each car is just over 100 bytes
printf( "sizeof car = %lu\n", (unsigned long)sizeof(car) );
All cars are going to be 100*285, which is about 29K bytes.
printf( "sizeof all cars = %lu\n", (unsigned long)sizeof(car_details) );
My guess is, that adding all your other global variables takes this up to the max allowed by 16 bit compilers of 64K of data.
The way you get round this is by
1. choosing the large model (not small)
2. putting global variables in different source files (then you get a max of 64K per variable), not 64K in total.
I repeat my earlier comment - GET A DECENT COMPILER!.
Modern 32 bit compilers have the same limit, but its like 2GB, not 64KB
There is no possible justification for continuing to use that old fossil.
> float price;//this is the one that makes it go wrong, it runs without it
Only because it saved you a K or so of data space.