This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
string constants
- To: gcc at gcc dot gnu dot org
- Subject: string constants
- From: brahmaiah vallabhaneni <vbrahmaiah at yahoo dot com>
- Date: Tue, 26 Dec 2000 06:43:10 -0800 (PST)
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/