fork download
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. int main(void){
  7. char* s[] = { "12, 34, 56, 78", "82.16, 41.296",
  8. "2, -3, 5, -7, 11, -13, 17, -19",
  9. "9.00009, 90.0009, 900.009, 9000.09, 90000.9" };
  10. int i, n = sizeof(s)/sizeof(*s);
  11.  
  12. for(i = 0; i < n; ++i){
  13. char *temp = malloc(strlen(s[i])+1);
  14. char *token = strtok(strcpy(temp, s[i]), ", ");
  15.  
  16. while (token != NULL) {
  17. printf("%s\n", token);
  18. token = strtok(NULL, ", ");
  19. }
  20. free(temp);
  21. }
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 2288KB
stdin
Standard input is empty
stdout
12
34
56
78
82.16
41.296
2
-3
5
-7
11
-13
17
-19
9.00009
90.0009
900.009
9000.09
90000.9