Use const_cast to cast parameter before passing it into a function : const_cast « Data Types « C++ Tutorial






#include <iostream>
using namespace std;

void print (char * str)
{
  cout << str << endl;
}

int main () {
  const char * c = "sample text";
  print ( const_cast<char *> (c) );
  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