Oct 3, 2010 at 3:26am UTC
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 UTC
Oct 3, 2010 at 4:02am UTC
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 UTC
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 UTC
They are both constant pointers to constant characters.
Oct 3, 2010 at 5:26am UTC
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.