C & C++ - strlen() - string length
strcmp() - String Compare strcpy() - String Copy strlwr() - String Lowercase
This function is used to determine the length of the string. It usually counts the number of characters present in the string except the NULL character. Finally it will return integer value as an output.
strlen in C programming - Syntax
Syntax: int *strlen(const char *str);
Note: size_t treats as an integer type.
Example program using strlen()
#include<stdio.h> #include<string.h> main() { char src[]={’W’,‘E’,‘L’,‘C’, ‘O’,‘M’,‘E’}; int result; clrscr(); printf(" The source string is %s ",src); result = strlen(src); printf(" The length of the string is %d ",result); return(0); }
Output:
The source string is WELCOME The length of the string is 7
strlen() - String Length strncat() - String n Concatenation
strncmp() - String n Compare strncpy() - String n Copy
strcat() - String Concatenation strcmp() - String Compare
strcpy() - String Copy strlen() - String Length