C++ char array Illustrates changing a character string using pointer

Description

C++ char array Illustrates changing a character string using pointer

#include <iostream>
using namespace std;
void main()//ww w . j  a  v a2  s .  c  o m
{
   char *c="this is a test";
   cout << "My sister's maiden name was " << c << "\n";
   c = "new value";  // Assigns new string to c.
   cout << "My sister's married name is " << c << "\n";
   return;
}



PreviousNext

Related