ivana_andreevska

Untitled

May 19th, 2021
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5. #define MAX 101
  6.  
  7. int lengthrecursive(char *string)
  8. {
  9.         if(*string=='\0')
  10.             return 0;
  11.         else
  12.             return 1+lengthrecursive(string+1);
  13. }
  14.  
  15. int main()
  16. {
  17.     char string[MAX];
  18.     gets(string);
  19.  
  20.     printf("%d",lengthrecursive(string));
  21.     return 0;
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment