Browse Source

refactoring: global variable changed

remotes/origin/Input_Handling
Sophia Weber 11 months ago
parent
commit
e72fffd3f1
  1. 8
      src/inputHandling.c

8
src/inputHandling.c

@ -4,7 +4,7 @@
#include <stdlib.h> #include <stdlib.h>
char data[1000];
char formulaBuffer[1000];
void deleteWhitespace(char* formulaString, int length); void deleteWhitespace(char* formulaString, int length);
op readFunction(char* formulaString, int length); op readFunction(char* formulaString, int length);
char* getNumbers(char* formulaString, int length, calc_op* formulaRef); char* getNumbers(char* formulaString, int length, calc_op* formulaRef);
@ -14,10 +14,10 @@ void showStruct(calc_op* formulaRef);
void input(char* formulaString, int length) { void input(char* formulaString, int length) {
deleteWhitespace(formulaString, length); deleteWhitespace(formulaString, length);
calc_op temp; calc_op temp;
memcpy(data, formulaString, length);
memcpy(formulaBuffer, formulaString, length);
temp.formel = formulaString; temp.formel = formulaString;
temp.funktionstyp = readFunction(data, 10);
if (getNumbers(data, length, &temp) == NULL){
temp.funktionstyp = readFunction(formulaBuffer, 10);
if (getNumbers(formulaBuffer, length, &temp) == NULL){
showStruct(&temp); showStruct(&temp);
} else { } else {
printf("Formular %s not supported", temp.formel); printf("Formular %s not supported", temp.formel);

Loading…
Cancel
Save