#include <string.h>
#include <stdio.h>
#define bool int
#define true 1
#define false 0
static bool is_digit(char c){
return c > 47 && c < 58;
}
static bool is_all_digit(char *s){
while(s){
if(is_digit(*s++)){
continue;
}
return false;
}
return true;
}
int main(){
char *s = "123456";
int i;
printf("len = %d\n", strlen(s));
for(i = 0; i<strlen(s); ++i){
printf("%c : %s\n", *s, is_digit(*s++)? "true" : "false");
//printf("%c : %s\n", s[i], is_digit(s[i])? "true" : "false");
}
return 0;
}
I want to realize the function as the part commented. But the result is the following:enter image description here
It ends with 3 and 4~6 is disappeared. My running environment is win10 gcc 6.3.0