Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int nstrlen(char *str, int res);
  5.  
  6. int main()
  7. {
  8.     char str[10];
  9.     printf("Entrez votre nom : ");
  10.     scanf("%s", str);
  11.  
  12.     printf("%d", nstrlen(str, 0));
  13.  
  14. }
  15.  
  16. int nstrlen(char *str, int res)
  17. {
  18.     int i = 0;
  19.     for (i = 0; str[i] != '\0'; i++)
  20.     {
  21.          res = i+1;
  22.     }
  23.     return res;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement