>>28
You forgot to check if malloc returned NULL. And strcpy is insecure.
#define BUFSIZE 200
char *s; /*Create string*/
s = malloc(BUFSIZE); /*Fixed-length string*/
if(s == NULL) /*Check if malloc failed*/
abort(); /*terminate in this case*/
memset(s, '\0', BUFSIZE - 1); /*Blank string*/
s[BUFSIZE - 1] = 0; /*Final zero*/
strncpy(s, "Hello world!", BUFSIZE - 1); /*Put message on string*/
printf("%s\n", s); /*Print message on screen*/