I appologize but i have not taken a C class in a couple of years and now that i am taking one I encountered a problem.
I am given the following two files which I am not allowed to modify using gcc on a unix server:
****p1.c *******
Code:
#include "getword.h"
int main()
{
int c;
char s[STORAGE];
for(;;) {
printf("n=%d, s=[%s]\n", c = getword(s), s);
if (c == -1) break;
}
}
***getword.h****
Code:
#include <stdio.h>
#include <string.h>
#define STORAGE 255
/* This is one more than the max wordsize that getword() can handle */
int getword(char *w);
**************************************************
i have to write getword.c which gets one word from the input stream and returns -1 iff EOF is encountered otherwise it returns the number of characters in the word
i can pass an input from the user from getword.c using fgets() however , how can this input be stored into the already declared char s[STORAGE] in p1.c ?