Advertisement
cchori

str_len

Sep 2nd, 2015
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define tam 10
  4.  
  5. size_t str_len(const char*);
  6.  
  7. void main ()
  8.  
  9. {
  10.     int len;
  11.  
  12.     char hache[]="Hola como va";
  13.     len=str_len(hache);
  14.  
  15.     printf("%d",len);
  16.  
  17. }
  18.  
  19. size_t str_len(const char* s1)
  20. {
  21.     int c=0;
  22.  
  23.     while(*s1)
  24.     {
  25.         c++;
  26.         s1++;
  27.     }
  28.     return(c);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement