#include #define MAXLINE 80 main() { char buf[MAXLINE]; char word[MAXLINE+1]; while (fgets(buf, MAXLINE, stdin) != NULL ) { getArg(buf,word); printf ("%s\n", word); } } getArg(char *buf, char *word) { char* p; int i; for (p = buf; isspace(*p); p++); /* skip leading spaces */ for (i = 0; !isspace(*p) && *p != '\0'; p++) /* get first word */ { word[i++] = *p; } word[i] = '\0'; }