I have this code in c language, it does check if a number written in a certain numeric base, decimal, octal, ..etc is correct, means that it is using characters which belongs to this certain base, for example, an octal number should only use characters [0, 1, 2, 3, 4, 5, 6, 7], it checks all the bases between 2 and 36.
The problem is that when I try to substring "base" characters from the total characters it give me a warning saying that ISO C90 forbids variable length array 'base_symbols'
int checkNumBase(char *num, int base){
char all_symbols[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char base_symbols[base];
int i;
unsigned int k;
for(i = 0; i<base; i++){
base_symbols[i] = all_symbols[i];
}
for(k = 0; k<strlen(num); k++){
if(strchr(base_symbols, num[k]) == NULL){
return 0;
}
}
return 1;
}