C语言程序设计
											大一新生求助编写一个函数,输入一行字符,将字符串中最长的单词输出。										
					
	 程序代码:
程序代码:#include<stdio.h>
#include<string.h>
int main()
{
  int len, maxlen = 0;
  char maxword[512]; 
  char buf[]="hello boy this is heimass";
  char *temp = NULL;
  
  temp = strtok(buf, " ");
  while (temp) {
    len = strlen(temp);
    if (len > maxlen) {
      strcpy(maxword, temp);
      maxlen = len;
    }
    temp = strtok(NULL," ");
  }
  printf("%s\n", maxword);
  return 0;
}