C Reference String Operation: strlen()
The strlen() function returns the length of a string.
The length is determined by the number of characters before the null termination.
Usage:
size_t strlen(char *str)
strlen() source code example:
#include<stdio.h>
#include<string.h>
main()
{
char line[100];
strcpy(line, "hello");
printf ("%d\n", strlen(line));
}
Output of the example:
5
This entry was posted in C Reference string.h Functions.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Tweet This! or use
to share this post with others.