SHARE
TWEET

cstr

a guest Oct 22nd, 2012 37 Never
  1. #include <string>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. void some_function(string str)
  7. {
  8.     cout << "str : " << str.c_str() <<endl;
  9. }
  10.  
  11. int main() {
  12.   const char* cstr = "Hello World!";
  13.   some_function(string(cstr));
  14. }
RAW Paste Data
Top