Browse Source

refactoring: freed allocated memory of result strings in main program

remotes/origin/conversionOfNumbers
Laurin 11 months ago
parent
commit
3a704ca670
  1. 3
      src/conversionOfNumbers/main.c

3
src/conversionOfNumbers/main.c

@ -1,6 +1,7 @@
#include "conversionOfNumbers.h"
#include "../userinput.h"
#include <stdio.h>
#include <stdlib.h>
int main(){
int min = 0;
@ -34,6 +35,7 @@ int main(){
int toConvert = usergetd("\nGeben Sie eine Ganzzahl ein: ", NULL, NULL);
char* result = convertIntToBinaryStr(toConvert);
printf("\nAusgabe (in Binaer): %s\n", result);
free(result);
}
}
if(InputSys == 1){
@ -47,6 +49,7 @@ int main(){
int toConvert = usergetd("\nGeben Sie eine positive Ganzzahl ein: ", &rangeMin, NULL);
char* result = convertIntToHex(toConvert);
printf("\nAusgabe (in Hex): %s\n", result);
free(result);
}
}
}

Loading…
Cancel
Save