String parsing in C using strtok
问题 I've got this little source code, made for testing the parsing of a string similar to variable string I need to use in other project #include <stdio.h> #include <stdlib.h> #include <string.h> int main (void) { char string[] = "C-AC-2C-3C-BOB"; char* s; char* hand[3]; char* usr; s = (char*) calloc(1, sizeof(char)); hand[1] = (char*) calloc(3, sizeof(char)); hand[2] = (char*) calloc(3, sizeof(char)); hand[3] = (char*) calloc(3, sizeof(char)); usr = (char*) calloc(21, sizeof(char)); s = strtok