IvoSilva

[PROG1] Ficha 10 | Exercício 2

Jan 9th, 2012
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.28 KB | None | 0 0
  1. #include <stdio.h>
  2. #define LIMIT 50
  3. int stringLen(char str[])
  4. {
  5.     int i = 0 ;
  6.     while (str[i] != '\0') i++ ;
  7.     return (i) ;
  8. }
  9. void main ()
  10. {
  11.     char str[LIMIT] ;
  12.     printf ("Palavra? ") ;
  13.     scanf ("%s" , str) ;
  14.     printf ("Comprimento : %d\n" , stringLen(str)) ;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment