Quote:
|
Originally Posted by amateurrobotguy
table(1)=5;
i=1
j=0
j=table(i);
"J"should return 5.
|
Could you please give more detailed examples next time?
At least show all variable declarations and functions with the important algorithm chopped off.
I'm sorry, but the code pieces you show aren't detailed enough (they don't show types or declarations -- just use bogus numbers or something)
I assume what you have in the code is something like:
Code:
/* Make sure to initialize your array. */
/* int variable[LENGTH]={val1,val2,val3,...} */
int table[10]={3,2,1,6,5,4,9,8,7,0};
void myfunction (void) {
int i=1;
int j=0;
j=table[i]; // Will give you "2", not "3": indicies start at 0, not 1
// Was that your question?
}
__________________
-Patrick Horn,
Paly Robotics
Check out the space simulator called
Vega Strike, modelled after the space simulator games Elite and Wing Commander. It's Open Source too!
If you have ever played
Wing Commander, or especially
Privateer, and had a feeling of nostalga derived from the you will enjoy these two Vega Strike mods:
Privateer Gemini Gold and
Privateer Remake!
I'm working on adding multiplayer support this year...