C Program to Find the Length of String

C Program to Find the Length of String

Write C Program to Find the Length of String

// C Program to Find the Length of String

#include <stdio.h>
#include <string.h>

int main()
{
	char S[50];
	printf("Enter the String :--> ");

	gets(S);

	//string function to find the length of the string
	printf("The length of the string :--> %d", strlen(S));
	return 0;
}

Output:

Enter the String :--> Good Morning
The length of the string :--> 12