Skip to content

Commit 2feeed5

Browse files
authored
Merge pull request TheAlgorithms#137 from s1l3ntcat/master
Added NULL check.
2 parents ffd651d + fc6a345 commit 2feeed5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

exercism/hello-world/hello_world.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
const char *hello(void)
66
{
77
char * ans = malloc(sizeof(char) * strlen("Hello, World!"));
8+
if (!ans) return NULL;
89
strcpy(ans,"Hello, World!");
910

1011
/* string is pointer of the first character */

0 commit comments

Comments
 (0)