In this program, you'll learn to find length of a string.
#include<iostream>
using namespace std;
int main()
{
char s[20];
int i=0, len=0;
cout<<"Enter the string\n";
gets(s);
while(s[i] != '\0')
{
len++;
i++;
}
cout<<"Length of given string = "<< len;
return 0;
}
Enter the string
Welcome to CPP
Length of given string = 14