Advertisement
Lawnknome

recursion

Nov 20th, 2014
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.22 KB | None | 0 0
  1. //count initialized in main as  count = 0;
  2.  
  3. int wordLength(char string[], int &count)
  4. {
  5.  
  6.     if(string[count] == '\0')
  7.     {
  8.         return 0;
  9.     }  
  10.  
  11.     else
  12.     {  
  13.         count++;
  14.         wordLength(string[], count);
  15.     }  
  16.  
  17.     return count;
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement