Cast parameter with const_cast : const_cast « Data Types « C++ Tutorial






void g(char* str)
{
}

void f(const char* str)
{
  g(const_cast<char*>(str));

}

int main(int argc, char** argv)
{
  char str[100];
  f(str);

  return (0);
}








2.31.const_cast
2.31.1.const_cast int value
2.31.2.const_cast char type
2.31.3.Use const_cast on a const reference
2.31.4.Use const_cast to cast parameter before passing it into a function
2.31.5.Cast parameter with const_cast