Learn C ProgrammingLearn ProgrammingPrograms On StringsResources

085. Write a program to print length of a given string in C language

By September 18, 2012 September 5th, 2018 No Comments
#include<stdio.h>
#include<conio.h>  
main()
{
	int i,len=0;
	char *s;
	clrscr();
	printf("Enter the string....");
	scanf("%s",s);
	for(i=0;s[i]!='\0';i++)
		len++;
	printf("The lenth of the string is...%d",len);
	getch();
}


Leave a Reply

DEMO01