rootUser

mystrlen

May 26th, 2016
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*   Writing own version of the "   strlen( )   "  library function which is named mystrlen( )   */    
  2. #include<stdio.h>
  3. int mystrlen(char a[]);
  4. int main(void)
  5. {
  6.     char a[999999];
  7.     gets(a);
  8.     int x=mystrlen(a);
  9.     printf("%d",x);
  10.     return 0;
  11. }
  12. int mystrlen(char a[])
  13. {
  14.     int i,counter=0;
  15.     for(i=0;a[i]!='\0';i++)
  16.     {
  17.         counter++;
  18.     }
  19.     return counter;
  20. }
Add Comment
Please, Sign In to add comment