Double Constant???

Oct 3, 2010 at 3:26am
Why do some parameter values have two "Constant" symbols on them... Example:

1
2
3
4
5
void Function( constant int number constant){
~~~~~~~~
~~~~~
~~~~
}
Last edited on Oct 3, 2010 at 3:26am
Oct 3, 2010 at 4:02am
That cannot and will not compile. Even if you removed the ~ and changed constant to const, it is still wrong.
Oct 3, 2010 at 4:36am
Yeah, I know I wrote it wrong. The Example Im confused about is this... And this is from a book.


Function( const char * const variable1, const char* const last)

why are there two const keywords for 1 parameter varaible?

Oct 3, 2010 at 4:39am
They are both constant pointers to constant characters.
Oct 3, 2010 at 4:55am
i see.
Oct 3, 2010 at 5:26am
The const before the * means that you can't modify the object pointed to (char). The const after the * means you can't modify the pointer (variable1) to make it point elsewhere.
Topic archived. No new replies allowed.