This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: strings and char *
- From: Bob Rossi <bob_rossi at cox dot net>
- To: Michael Surette <msurette at laframboise dot net>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Thu, 10 Aug 2006 14:10:30 -0400
- Subject: Re: strings and char *
- References: <ebfs8m$6s4$1@sea.gmane.org>
On Thu, Aug 10, 2006 at 02:00:59PM -0400, Michael Surette wrote:
> It's been a while since I've written any C code, so please forgive me if
> this is a newbie type question.
>
> I was having a problem with a larger program when I ran into a problem. The
> following code snippet should work according to what I remember of C.
> What's wrong with it?
>
> ------------
>
> char * color;
> char * r="red";
> color = r;
Is that at the global scope? You can't make assignments in the global
scope unless they are definitions as well. Try putting that code in a
function scope.
Bob Rossi