You are given a null-terminated string containing words separated by a delimiter character (like comma , or space ' ').
Your task is to:
- Split the string into individual tokens based on the delimiter
- Store the tokens in a 2D array of characters (char tokens[10][20])
- Print each token on a new line
Do not use strtok() or any string library functions.
Example-1
Input:
str = "cmd1,cmd2,cmd3"
delimiter = ','
Output:
cmd1
cmd2
cmd3
Example-2
Input:
str = "ON OFF RESET"
delimiter = ' '
Output:
ON
OFF
RESET