meaning of const char *const ? 
Author Message
 meaning of const char *const ?

I looked through some source code and saw
const char *const tst ...
Whats the meaning of the second const here?


Sat, 14 Feb 2004 14:49:25 GMT  
 meaning of const char *const ?


Quote:
> I looked through some source code and saw
> const char *const tst ...
> Whats the meaning of the second const here?

tst is a constant pointer to a constant char.

The first const means the char it's pointing to is constant, so things like:
*tst = 'a'; will not work.

The second const means tst points to a constant place in memory, so things
like: tst = &other_variable; will not work.

HTH,
--
David Scarlett

http://www.listen.to/artifice/
http://members.optushome.com.au/dscarlett/

"Damn it, Kif, where's the little umbrella? That's what makes it a scotch on
the rocks!"
        -Capt. Zapp Brannigann, Futurama



Sat, 14 Feb 2004 14:56:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help: inline char const* const& max(char const* const &a, char const* const &b)

2. const char * vs char const *

3. const char *p == char const *p ?

4. Why not static const char * const __func__ ?

5. Conversion const char* -> const unsigned short*

6. char** and const char** ...

7. va_arg(ap, const char *) = char*?

8. const char* to char[64]

9. char^ to const char* casting

10. const char ** incompatible with char ** (and vice versa)?

11. passing const char* to char* fails

12. const char* vs. char *

 

 
Powered by phpBB® Forum Software