I'm working on a program thats supposed to read a line in, then pass it to a function which prints the line one word per line, like this,
>>>> ENTER A LINE:
this is a test
<<<< RESULT (4 words):
this
is
a
test
the code below is just the snippet from the function. My problem is it gives me warnings saying, "[Warning] passing arg 1 of `getc' from incompatible pointer type" and "[Warning] passing arg 2 of `putc' from incompatible pointer type". I'm not real sure what I'm doing wrong, any help would be appericated
Code:
#define MAXLEN 128
int mystrtokens(char line[], char *words)
{
/* Variables */
char read[128];
char ch;
char *word[MAXLEN];
int count;
int i = 0;
do
{
do
{
ch = getc(*word);
if(isspace(ch) != 0)
{
*word = line;
}
else (putc('\0', line));
++i;
}while (*word != ' ' && *word != '\0');
++count;
}while(line != EOF);
return *word, count;
}
sorry I added the variables now