太简单了, 这样:
程序代码:
int maxwordlen(char *S) { int maxlen = 0; int maxtmp = 0; while(*S) { if(isspace(*S)) { maxlen = max(maxlen, maxtmp); maxtmp = 0; } else { maxtmp++; } S++; } maxlen = max(maxlen, maxtmp); return maxlen; }