|
Re: Pre-Load Arrays in EasyC, Possible?
I haven't focused any attention on EasyC, so take this with a grain of salt.
But from a C perspective...
power[3] in C has three locations available not four.
You may be confusing this with the index which starts with zero.
Initializing it with 3 values should work, i.e., {0,0,0}, or use power[4] instead.
In your example of setting the values at runtime you are actually overwriting the memory location past the end of the power array. The compiler doesn't check for this (there are other commercial tools that perform that function).
You can actually do something like "power[99] = 1;" and the program won't complain, but some other part of your code may mysteriously start acting erratically.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
|