Re: [RFClue] Constant declaration

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

 



On Tuesday 11 October 2005 17:12, Felix Oxley wrote:
> I hope somebody can explain this to me. :-)
> 
> In certain places I have seen the following code:
> 
> static const char *foo = "ABC";
> 
> int main(int argc, char *argv[])
> {
>         foo = "some other value";
> }
> 
> 
> How can this be allowed? foo has been declared constant and yet is being 
> assigned a new value ?

It is the string that is constant, not the pointer.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux