Is it safe to do something like the following?
#include #include #include int main(void) { char* msg;
Use:
#define MYSTRDUP(str,lit) strcpy(str = malloc(strlen(lit)+1), lit)
And now it's easy and standard conforming:
char *s; MYSTRDUP(s, "foo bar");