I've been tasked to do a program that separates and changes words from a string of words separated by " "(spaces) but I can't seem to make strtok work. I get errors saying: "Expected expression before 'char' and Too few arguments" Can you please help me identify the problem and how I could fix it?
PS: I do know that the gets(); function is dangerous but my teacher specifically instructed us to use it. I can't use anything else for input.
Main
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "header.h"
main()
{
char str[350];
char token[350];
gets(str);
inputProcess(char *str,char *token);
}
header.h
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char inputProcess(char*input, char*tok){
tok = strtok(input," ");
while(tok!= NULL)
{
printf("%s",tok);
tok=strtok(NULL," ");
}
}
Help would be very much appreciated.