How to convert const char* to char* in C?

First of all you should do such things only if it is really necessary – e.g. to use some old-style API with char* arguments which are not modified. If an API function modifies the string which was const originally, then this is unspecified behaviour, very likely crash. Use cast: (char*)const_char_ptr

how to convert from int to char*?

In C++17, use std::to_chars as: std::array<char, 10> str; std::to_chars(str.data(), str.data() + str.size(), 42); In C++11, use std::to_string as: std::string s = std::to_string(number); char const *pchar = s.c_str(); //use char const* as target type And in C++03, what you’re doing is just fine, except use const as: char const* pchar = temp_str.c_str(); //dont use cast