|
char * p = "hello";
* The content of * p cannot be changed. The c-style string is const here, so you must use p to point to a block of memory
#include <vector>
#include <string>
#include <algorithm>
#include <iterator>
#include <iostream.h>
using namespace std;
main ()
{
char * p = "hello";
char * q;
q = new char (10);
q [0] = 0x20;
q [1] = 0x00;
strcat (q, p);
p = q;
cout << p << endl;
system ("pause");
delete q;
} |
|