View Single Post
  #2   Spotlight this post!  
Unread 13-02-2006, 11:55
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,809
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
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