From 1bbb981f09fb0e935d429d94d68ab10522aca321 Mon Sep 17 00:00:00 2001 From: Andinus Date: Fri, 3 Sep 2021 10:56:33 +0530 Subject: C: Acronym: Single statement for initial check --- c/acronym/src/acronym.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'c') 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 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)); -- cgit 1.4.1-2-gfad0