C examples for string.h:strlen
function
<cstring> <string.h>
Returns the length of the C string str.
size_t strlen ( const char * str );
Parameter | Description |
---|---|
str | C string. |
The length of string.
#include <stdio.h> #include <string.h> int main ()/* w ww . jav a 2 s . co m*/ { char szInput[256]; printf ("Enter a sentence: "); gets_s (szInput); printf ("The sentence entered is %u characters long.\n",(unsigned)strlen(szInput)); return 0; }