1 2 3 4 5 6 7 8 9
#include <stdlib.h> #include <string.h> char *somestr(void) { char *buf = malloc(sizeof("Hello, world!")); strcpy(buf, "Hello, world!"); return buf; }