Re: Constant declaration

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

 



On 10/12/05, gaurav sharma <togsharma@xxxxxxxxx> wrote:
> I guess they are not same.
> 1) const char *p="hello"; // non constant pointer, constant data
> 2) char const *p="hello"; // constant pointer, non constant data
>
> What say ?
>

Both 1 and 2 are same ... confirm (i tested it in kernel module) .....
but for constant pointer use:
char *const p="hello";

or for both pointer and data constant use:
const char *const p="hello";


--
Fawad Lateef

--
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