C++ Program to Find the Length of String
Write C++ Program to Find the Length of String
// CPP Program to Find the Length of String
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char S[50];
cout << "Enter the String :--> ";
gets(S);
//string function to find the length of the string
cout << "The length of the string :--> " << strlen(S);
return 0;
}
Output:
Enter the String :--> Good Morning
The length of the string :--> 12