The strlen() function returns the length of the given string. It doesn't count null character '\0'.
#include<stdio.h>
#include <string.h>
int main(){
char ch[20]={'a','n','m','o','l','k','n','o','w','l','e','d','g','e', '\0'};
printf("Length of string is: %d",strlen(ch));
return 0;
}
Output:
No comments:
Post a Comment