Making a char function parameter const?

Posted by Helper Method on Stack Overflow See other posts from Stack Overflow or by Helper Method
Published on 2010-12-21T13:49:38Z Indexed on 2010/12/21 13:54 UTC
Read the original article Hit count: 142

Filed under:
|

Consider this function declaration:

int IndexOf(const char *, char);

where char * is a string and char the character to find within the string (returns -1 if the char is not found, otherwise its position). Does it make sense to make the char also const? I always try to use const on pointer parameters but when something is called by value, I normally leave the const away.

What are your thoughts?

© Stack Overflow or respective owner

Related posts about c++

Related posts about c