whether this is valid

From: madhur (madhur_at_sdf.com)
Date: 06/26/04


Date: Sun, 27 Jun 2004 02:19:43 +0530

Hello

char *a="str";
strcpy(a,"abc");

I have learnt that since "a" is a string literal, it might be allocated on
read only memory on some implementations.
Is it correct to modify a string literal using this way.

Madhur Ahuja
India



Relevant Pages

  • Re: whether this is valid
    ... In 'comp.lang.c', "madhur" wrote: ... > read only memory on some implementations. ... > Is it correct to modify a string literal using this way. ...
    (comp.lang.c)
  • Re: whether this is valid
    ... madhur wrote: ... > allocated on read only memory on some implementations. ... > Is it correct to modify a string literal using this way. ...
    (comp.lang.c)
  • Re: whether this is valid
    ... > read only memory on some implementations. ... > Is it correct to modify a string literal using this way. ... If it were legal, why on earth would you do it? ...
    (comp.lang.c)
  • Re: whether this is valid
    ... >read only memory on some implementations. ... >Is it correct to modify a string literal using this way. ... to declare it const char *a so the compiler can detect if you try to ...
    (comp.lang.c)
  • Re: Deleting a preloaded image from memory
    ... The variable aVar then gets assigned to memory address ABC. ... these types of generalisations about javascript implementations. ... you waffle on about the history of computers as if it was unknown. ...
    (comp.lang.javascript)