Im using strtok
and getting a little confused.
I have an array holding a lot of strings and I want to tokenize the strings into a temporary array. When i perform the strtok it stored the first token in the temporary array, but also changed the original arrays value. So im pretty confused.
char cmdTok[10] , *cmd = cmdTok;
printf("command[0] = %s\n", commands[0]);
cmd = strtok(commands[0], " \n\0");
printf("command[0] after strtok = %s\n", commands[0]);
Output being
command[0] = #Draw A Ring
command[0] after strtok = #draw
How do i retain the original values in command?