I have been trying to make it so that placeholders like (%c) or (%d) are used as delimiters but whenever I try to it will also use the letter after the percent as a delimiter as well. Is there a way to make it so that both characters together are the delimiter and not so they are separate delimiters.
#include <stdio.h>
#include <string.h>
int main (void){
char string[100];
printf("Enter a string: ");
fgets(string,sizeof(string),stdin);
string[strlen(string)-1] = '\0';
char seperator[] = " %c";
char *token = strtok(string,seperator);
while(token != NULL){
printf("%s\n",token);
token = strtok(NULL,seperator);
}
return 0;
}