[Solved] Complex algorithm to extract numbers/number range from a string
You’re issue seems to be misunderstanding how strtok works. Have a look at this. #include <string.h> #include <stdio.h> int main() { int i, j; char delims[] = ” ,”; char str[] = “1-5,6,7”; char *tok; char tmp[256]; int rstart, rend; tok = strtok(str, delims); while(tok != NULL) { for(i = 0; i < strlen(tok); ++i) … Read more