Here is my simple working program:
But I have a question: how to make it work if macro would be replaced with an average function?
#define CHANGE_STR(old_str, new_str) (old_str = new_str)
char *msg = "This is old message.";
CHANGE_STR(msg, "This is my new message.");
I completely understand that using CHANGE_STR as function is completely irrational (since macro does the trick perfectly). But still, is it possible at all? If yes, then how to make it work? I'd just like to understand the logic of the C as deeply as possible.
void CHANGE_STR(char *old_str, char *new_str)
Some code here.
I have tried several tricks but so far nothing seems to work.