When compiling a program with a 2 dimensional array, we get
"segmentation fault" when executing the program when
performing a string storage into a globally declared 2
dimentional array. This program compiles and executes
properly on AIX, SCO Unixware, SCO Open Server, AT&T Unix
V.4, and various releases of these systems. It also
compiles and works correctly on Caldera Linux Release 1.2.
I have a sample program that can be provided that exhibits
the problem. We need to resolve this problem so that we can
release our commercial software products (hopefully) on
Redhat Linux 6.0. I can be contacted via e-mail at
rross. I hope to hear from you soon.
I cannot seem to be able to send a attachment to provide a sample of
the code that exhibits the problem. If someone will e-mail me, I can
reply with an attachment showing an example of the problem.
Just reply to this message with test program included. Thanks.
The declaration "char *Words" declares Words to be an array of
pointers to char (note that it is not an array of arrays of char).
Therefore the strings in the initializer " " are
string constants (and thus readonly), not an initialized array of
char (which would be read/write). If you want more explanation,
go to comp.lang.c (or your favorite such source) - I realize that
I'm not really offering a full explanation here.
If you want to just get your code to work (without having to
fix it), supply the -fwritable-strings option to gcc.