C++ examples for Data Type:char array
Get string Length
#include <iostream> #include <cstring> // prototype for strlen using namespace std; int main() // ww w . j a v a 2s .c o m { char *string1 = "abcdefghijklmnopqrstuvwxyz"; char *string2 = "four" ; char *string3 = "test"; cout << "The length of \"" << string1 << "\" is " << strlen( string1 ) << "\nThe length of \"" << string2 << "\" is " << strlen( string2 ) << "\nThe length of \"" << string3 << "\" is " << strlen( string3 ) << endl; }