Browse Source

implemented function for determining string length of hex string

remotes/origin/conversionOfNumbers
Laurin 11 months ago
parent
commit
f68766a844
  1. 12
      src/conversionOfNumbers/conversionOfNumbers.c

12
src/conversionOfNumbers/conversionOfNumbers.c

@ -51,6 +51,18 @@ unsigned int convertBinaryStrToInt(char* input){
return result;
}
int hexStrLen(int input){
int length = 0;
if(input == 0) return 1;
for (int x = 0; x <= input; x++){
if(pow(16,x) >= input + 1){
length += x;
break;
}
}
return length;
}
char* convertIntToHex(int input){
int length = 1;
int rest;

Loading…
Cancel
Save