While trying to compile a programme, i get the following warning:
tokenizer.cpp:121: warning: array subscript has type 'char'
The array is a table mapping special meanings to the ASCII character sets. For instance i want to extract quotes, whitespace and such:
Code:
#include <stdio.h>
#include <string.h>
const char tokTable[128];
void parseInput(const char* input) {
int posCount=0;
while (*input) {
if (tokTable[*input]==1){
printf("found a space at pos: %d\n",posCount);
}
++input; ++posCount;
}
}
int main(int argc, const char** argv) {
char* ptok=(char*)tokTable;
bzero(ptok,sizeof(tokTable));
ptok[32]=1; // space
//tokTable[]; and so forth
parseInput("Hey you!");
return 0;
}
How can i fix the warning at: 'tokTable[*input]'
I am using gcc 4.3.0