Re: strings and char *

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Surette wrote:

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;

You cannot do that in file scope.

Inside a function it works:

void f( void )
{
    char * color;
    char * r = "red";

    color = r;
}


Regards.

Luca Masini

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux