summary refs log tree commit diff stats
path: root/c
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-09-03 10:56:33 +0530
committerAndinus <andinus@nand.sh>2021-09-03 10:56:33 +0530
commit1bbb981f09fb0e935d429d94d68ab10522aca321 (patch)
tree762cf509bffc6a71dbf06e542640e56edad013f8 /c
parentd17dcc9dc41408c186543603d4d2b1bda24f218a (diff)
downloadexercism-1bbb981f09fb0e935d429d94d68ab10522aca321.tar.gz
C: Acronym: Single statement for initial check
Diffstat (limited to 'c')
-rw-r--r--c/acronym/src/acronym.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/c/acronym/src/acronym.c b/c/acronym/src/acronym.c
index 9d86a6d..6bc3b10 100644
--- a/c/acronym/src/acronym.c
+++ b/c/acronym/src/acronym.c
@@ -3,8 +3,7 @@
 #include <stdlib.h>
 
 char *abbreviate(const char *phrase) {
-    if (phrase == NULL) return NULL;
-    if (phrase[0] == '\0') return NULL;
+    if (phrase == NULL || phrase[0] == '\0') return NULL;
 
     size_t pos = 0;
     char *acronym = malloc(1 * sizeof(char));