Fill in the blank string length

Questions description
reader, by filling in the appropriate expression or statement in the space, the integrity of the process and meet the subject requirements.
The following function MyStrlen () function is a pointer p points to calculate the length of the string.


#include <stdio.h> 
unsigned int MyStrlen(char *p) 
{ 
   unsigned int len; 
   len = 0; 
   for(; *p !=    ①   ; p++) 
   { 
      len    ②   ; 
   } 
   return    ③   ; 
} 
int main() 
{ 
   char str[21]; 
   gets(str); 
   printf("%d", MyStrlen(str)); 
   return 0; 
} 

Note: Be sure to submit a complete code, do not modify the code framework.

#include <stdio.h> 
unsigned int MyStrlen(char *p) 
{ 
   unsigned int len; 
   len = 0; 
   for(;*p !='\0';p++) 
   { 
      len++; 
   } 
   return len; 
} 
int main() 
{ 
   char str[21]; 
   gets(str); 
   printf("%d", MyStrlen(str)); 
   return 0; 
} 

Guess you like

Origin blog.csdn.net/Lhw_666/article/details/91415332