Illustrates changing a character string using pointer - C++ Data Type

C++ examples for Data Type:Array Pointer

Description

Illustrates changing a character string using pointer

Demo Code

#include <iostream>
using namespace std;
void main()/*w  w  w . java2s  . co  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;
}

Result


Related Tutorials