Browse Source

change temp formular struct to pointer

remotes/origin/Input_Handling
Sophia Weber 12 months ago
parent
commit
28564e7701
  1. 16
      src/inputHandling.c

16
src/inputHandling.c

@ -5,17 +5,21 @@
char formulaBuffer[1000];
calc_op* mainCalc = NULL;
void processInput(char* formStr, int len) {
deleteWhitespace(formStr, len);
calc_op temp;
if (mainCalc!=NULL){
free(mainCalc);
}
mainCalc = malloc(sizeof(calc_op));
memcpy(formulaBuffer, formStr, len);
temp.formular = formStr;
temp.functionsType = detectFunctionOperator(formulaBuffer, 10);
if (getNumbers(formulaBuffer, len, &temp) == NULL){
showStruct(&temp);
mainCalc->formular = formStr;
mainCalc->functionsType = detectFunctionOperator(formulaBuffer, 10);
if (getNumbers(formulaBuffer, len, mainCalc) == NULL){
showStruct(mainCalc);
} else {
printf("Formular %s not supported", temp.formular);
printf("Formular %s not supported", mainCalc->formular);
}
}

Loading…
Cancel
Save