devxlogo

Print the Length of the String Without Using strlen()

Print the Length of the String Without Using strlen()

The following code reads one string, and prints the length of that without using strlen():

 #include #include int main(){	char s[20];	gets(s);	printf("  %d ",printf("%s",s));/*return type of printf() is int. so itreturns the number of characters it prints.*/}

devx-admin

Share the Post: