A string can be something that holds many characters in it. For instance, “That” can be known as a string. We mostly use C-style strings. In reality, it is an array. Strings work like arrays which have characters in it. Strings are covered by “”.
“That is a string”
The format of defining the string is:
Now, a string will be made having 40 char in it. Always remember that arrays start from 0. Moreover, arrays get ended with void char. Strings gives an additional char at the closing stage. However, that char can not be calculated. So, if you create a string of 40 char then you will store only 39 char in it.
char *arry; It is up to you to use it the same as string.
If you have to use the option of delete then you have to use  amid it.
delete  arry.
If you have to use lengthy entries then you should use strings. So, it is better to hold it through cin.getline which is a function.
The format for this is given below:
You can get admittance to an array with the help of “char *buffer”. The length is given in the form of “ int length”. Char terminal_char shows that string will end when the user will key in whatsoever is the char. The “cin.getline(arry,25)” can be used for creating new array.
using namespace std;
cout<<"Write an extended string: ";
cin.getline ( string, 256, '\n' );
cout<<"The extended string was: "<< string <<endl;
It is important to know that array does not need to define the address for their passage. ‘\n’ informs the compiler that getline will get ended on this char.
The cstring is known as header file. One of its important functions is comparison strings.
int strcmp ( const char *s1, const char *s2 );
The strcmp will get 2 strings and will give back an integer which will be:
S1 is less than S2.
S1 = S2.
S1 is greater than S2.
strcmp gives the location of char to function.
char *strcat ( char *dest, const char *src );
The strcat gives addition on the end. Through this, 2nd string can get added into 1st.
char *strcpy ( char *dest, const char *src );
The strcp duplicates the elements of src into dest.
size_t strlen ( const char *s );
The strlen gives back the extent of string. It excludes the terminating character. Size_t acts like an integer but it does not become negative/
This is a program for your practice:
using namespace std;
char fullname; // so immense to clasp both name and lastname
cout<<"Please type your name: ";
cin.getline ( name, 48 );
if ( strcmp ( name, "Harry" ) == 0 )
cout<<"That's also my name.\n";
cout<<"This name is not mine.\n";
// Search out the span of the entered name
cout<<"The entered name is "<< strlen ( name ) <<" letters long\n";
cout<<"Type your last name: ";
cin.getline ( lastname, 48 );
fullname = '\0';
strcat ( fullname, name );
strcat ( fullname, " " );
strcat ( fullname, lastname ); fullname
cout<<”Full name is "<< fullname <<"\n";