Mega Code Archive
Categories
/
C++ Tutorial
/
Data Types
Use const_cast to cast parameter before passing it into a function
#include
using namespace std; void print (char * str) { cout << str << endl; } int main () { const char * c = "sample text"; print ( const_cast
(c) ); return 0; }