C++ examples for Data Type:char array
What does this program do? \0 terminated string
#include <iostream> using namespace std; void mystery1( char *, const char * ); // prototype int main() { /*from ww w .j a v a2 s .c o m*/ char string1[ 80 ]; char string2[ 80 ]; cout << "Enter two strings: "; cin >> string1 >> string2; mystery1( string1, string2 ); cout << string1 << endl; } void mystery1( char *s1, const char *s2 ) { while ( *s1 != '\0' ) ++s1; for ( ; *s1 = *s2; ++s1, ++s2 ) ; // empty statement }