Browse Source

implemented binaryStrLen function into convertIntToBinaryStr

remotes/origin/conversionOfNumbers
Laurin 11 months ago
parent
commit
6fd5e28d8c
  1. 3
      src/conversionOfNumbers/conversionOfNumbers.c

3
src/conversionOfNumbers/conversionOfNumbers.c

@ -20,8 +20,7 @@ int binaryStrLen(int input){
} }
char* convertIntToBinaryStr(int input){ char* convertIntToBinaryStr(int input){
if(input > 3 || input < 0) return NULL;
int length = 2;
int length = binaryStrLen(input);
int rest; int rest;
char* result = (char*)malloc(sizeof(char) * length + 1); char* result = (char*)malloc(sizeof(char) * length + 1);
result[length] = '\0'; result[length] = '\0';

Loading…
Cancel
Save