Syntax
#include <string.h> size_t strlen(const char *string);Description
strlen determines the length of string excluding the terminating null byte.
strlen returns the length of string.
This example determines the length of a string.
#include <stdio.h>
#include <string.h>
int main(int argc,char **argv)
{
char *String = "How long is this string?";
printf("Length of string \"%s\" is %i.\n", String, strlen(String));
return 0;
/****************************************************************************
The output should be:
Length of string "How long is this string?" is 24.
****************************************************************************/
}
Related Information