C programming strlen string.h


In C programming the <string.h> strlen function gives the length of the string excluding the null-terminating character.The declaration of the function is given below.

size_t strlen(const char *s);

Parameters:
s -The string whose length is to be computed.

Return type
size_t -Returns the length of the string before the null-terminating character.

Code example

char s[]=”The new string”;

size_t lgh;

lgh=strlen(s) ;

printf(“lgh=%d” , lgh);

Output,

lgh=14


Related links

->C strerror string.h

->C memset string.h