#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
char string1[ 20 ];
char string2[] = "string literal";
cout << "Enter the string: ";
cin >> string1;
cout << "string1 is: " << string1 << "\nstring2 is: " << string2;
for ( int i = 0; string1[ i ] != '\0'; i++ )
cout << string1[ i ] << ' ';
cin >> string1;
cout << "\nstring1 is: " << string1 << endl;
return 0;
}
Enter the string: string
string1 is: string
string2 is: string literals t r i n g
string
string1 is: string