TheAlgorithms-C/exercism/hello_world/hello_world.c
2020-01-09 10:27:32 +01:00

14 lines
288 B
C

#include "hello_world.h"
#include <stdlib.h>
#include <string.h>
const char *hello(void)
{
char * ans = malloc(sizeof(char) * strlen("Hello, World!"));
if (!ans) return NULL;
strcpy(ans,"Hello, World!");
/* string is pointer of the first character */
return ans;
}