Re: const modifier

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

 



Pardon me....
I am a bit confused with the explanation...

this is how i understand the two:

const char * some_ptr; <---- declares some_ptr to be a pointer to a const
char.
* this means that the value pointed to by some_ptr cannot be changed.

char *const some_ptr; <----- declares some_ptr to be a constant pointer to a
char.
* this means that the value of some_ptr cannot be changed.

I think that the two are different... but I'm not sure... =)

----- Original Message -----
From: "Dharmender Rai" <dharmendra_rai@yahoo.com>
To: "tune more" <tunemore@yahoo.com>; <kernelnewbies@nl.linux.org>
Sent: Sunday, October 27, 2002 8:54 PM
Subject: Re: const modifier


> const char * some_ptr;
> // is same as
> char * const some_ptr;
> // You can think in this way:
> /* In the later one, const is used for some_ptr that
> is a pointer to char. So here the pointer is constant.
> In the former case also you have made ( char *) as
> constant :). So they are the same
> */
>
>  --- tune more <tunemore@yahoo.com> wrote: > Hi,
> >
> > Here is an example of "const modifier" usage:
> >      int execv(const char *path, char *const
> > argv[]);
> > Is there any different between const before char *
> > and
> > const after char *.
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Y! Web Hosting - Let the expert host your web site
> > http://webhosting.yahoo.com/
> > --
> > Kernelnewbies: Help each other learn about the Linux
> > kernel.
> > Archive:
> > http://mail.nl.linux.org/kernelnewbies/
> > FAQ:           http://kernelnewbies.org/faq/
> >
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
> --
> Kernelnewbies: Help each other learn about the Linux kernel.
> Archive:       http://mail.nl.linux.org/kernelnewbies/
> FAQ:           http://kernelnewbies.org/faq/
>
>

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