A 'char' may be 'signed' or 'unsigned'. Most regular compilers will default to 'signed'.
So if you have an array with index 127, you increment the index and it becomes -128.
This may of course be your intention.
A 'safe' type to use for an array
index is 'int' or 'unsigned char'.
char idx; /// limited range
somedata[idx] = otherdata;
==> (to eliminate the warning...)
unsigned char idx;
int idx;
memo.
沒有留言:
張貼留言