string constants

brahmaiah vallabhaneni vbrahmaiah@yahoo.com
Tue Dec 26 06:43:00 GMT 2000


Hi,
  I have a doubt regarding string constants.
please see the following example.

   char *p = "megcc";

  for (i = 0; i < strlen (p); i++)
      p[i] =  'a';
  when I run this program it will give segmentation
fault.  
  If I compile the program using -fwritable-string
 it works fine.
   But  if I make 

  p as static char *p, it should work (guess).
 but actually it is not. It still gives segmentation
fault. Could you help me with this.

  regards

V.Brahmaiah






__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Thousands of Stores. Millions of Products.
http://shopping.yahoo.com/


More information about the Gcc mailing list