daily pastebin goal
14%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. char* get_word(char* str)
  2. {
  3.     if(str==NULL)
  4.         return NULL;
  5.     int i=0;
  6.     int j=0;
  7.     char tmp[1001];
  8.     char *pTmp=tmp;
  9.     while(*str!=0)
  10.     {
  11.         if(isalpha(*str)!=0)
  12.             j++;
  13.         str++;
  14.         i++;
  15.     }
  16.     if(j==0)
  17.         return NULL;
  18.     str=str-i;
  19.     i=0;
  20.     while(*str!=0)
  21.     {
  22.         *pTmp=*str;
  23.         pTmp++;
  24.         if(isspace(*str)!=0 || isalpha(*str)==0)
  25.         {
  26.             if(isspace(*(str+1))!=0 || isalpha(*(str+1))==0)
  27.             {
  28.                 str++;
  29.                 i++;
  30.             }
  31.             else
  32.             {
  33.                 *str='\n';
  34.             }
  35.         }
  36.         str++;
  37.         i++;
  38.     }
  39.     return str-i;
  40.  
  41. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top