size_t strlen ( const char * str );
char mystr[100]="test string";
123456789101112
/* strlen example */ #include <stdio.h> #include <string.h> int main () { char szInput[256]; printf ("Enter a sentence: "); gets (szInput); printf ("The sentence entered is %u characters long.\n",(unsigned)strlen(szInput)); return 0; }
Enter sentence: just testing The sentence entered is 12 characters long.