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

Leave a Comment