#include
#include
int main(int argc, char *argv[])
{
cout << "size of String " << sizeof( string );
you can also use strings and can find out its length by string.length() function. look at the below code:
// Finding length of a string in C++
#include
#include
using namespace std;
int count(string);
int main()
{
string str;
cout << "Enter a string: ";
getline(cin,str);
cout << "\nString: " << str << endl;
cout << count(str) << endl;
return 0;
}
int count(string s){
if(s == "")
return 0;
if(s.length() == 1)
return 1;
else
return (s.length());
}
you can get the details from : http://www.programmingtunes.com/finding-length-of-a-string-in-c/