View Single Post
  #5   Spotlight this post!  
Unread 25-01-2005, 13:50
Ssbfalcon's Avatar
Ssbfalcon Ssbfalcon is offline
The beta version
AKA: Arthur
FRC #1546 (Chaos Inc.)
Team Role: Alumni
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Baldwin, New York
Posts: 8
Ssbfalcon is an unknown quantity at this point
Send a message via AIM to Ssbfalcon
Re: Array Problems: Possible<stdio.h>

Personally I would have come up with a formula to automate this for you.

Either way, you shouldn't use an integer array as the values range from 0-255. Because of that, all you need are unsigned chars, which range from 0 to 255.

Just incase you're unsure of the syntax...
Code:
 unsigned char speed_array[255] ={0,0, ... 255};
Ints normally use 2 bytes, while chars use 1 byte. The integer array of 256 would be 512 bytes while the char array only 256 bytes. That's one method of code optimization that you should look out for. It's easy to just write ints for everything, when all that's required is a char whether it's signed or unsigned. Remember that the system we're coding under has limited resources, and little things like these can mean cutting off an extra feature.

Still, if we had some more resources...
__________________
Don't Lick Dry Ice!