From 6fd5e28d8cf9da1cf2fe54582624319af2e6a9c9 Mon Sep 17 00:00:00 2001 From: Laurin Date: Wed, 31 Jan 2024 00:58:35 +0100 Subject: [PATCH] implemented binaryStrLen function into convertIntToBinaryStr --- src/conversionOfNumbers/conversionOfNumbers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/conversionOfNumbers/conversionOfNumbers.c b/src/conversionOfNumbers/conversionOfNumbers.c index c71b53e..7bf51b2 100644 --- a/src/conversionOfNumbers/conversionOfNumbers.c +++ b/src/conversionOfNumbers/conversionOfNumbers.c @@ -20,8 +20,7 @@ int binaryStrLen(int input){ } char* convertIntToBinaryStr(int input){ - if(input > 3 || input < 0) return NULL; - int length = 2; + int length = binaryStrLen(input); int rest; char* result = (char*)malloc(sizeof(char) * length + 1); result[length] = '\0';