Can anybody tell me what is the use of c_str() function in C/C++?. In which case it is necessary to use it?.
When you want to use your string with C-functions
string s = "hello";
printf( "your string:%s", s.c_str() );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With