--- In [email protected], "totallyfreeenergy" <totallyfreeene...@...> 
wrote:
>
> char* pChar;
>  pChar = "Hello";
> 
> pChar is considered a constant and placed in read-only
> section of memory.

Strictly speaking it's the string which is placed in read-only memory; the 
pointer variable pChar is in 'ordinary' memory, so it can be modified to point 
somewhere else.

The simple solution is to use:

  char str[] = "Hello";

This declares a variable which is an array of characters, instead of a pointer 
variable. And str hasn't been declared const, so it may be modified.

Reply via email to