From eb1cc638ef7e5321a4b3149793c6011c0b2071ea Mon Sep 17 00:00:00 2001 From: zinee2 Date: Sat, 6 May 2017 16:28:15 +0900 Subject: [PATCH 1/2] pointer --- calc.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/calc.c b/calc.c index 85f1466..edf6cbd 100644 --- a/calc.c +++ b/calc.c @@ -3,31 +3,32 @@ int main(){ FILE *fp = NULL; - int operand1, operand2; + double operand1, operand2; char operator = ' '; - int result, line = 0; + double (* result)(double, double); + double line = 0; fp = fopen("read.txt","r"); if(fp!=NULL){ - fscanf(fp, "%d", &line); + fscanf(fp, "%lf", &line); for(int i=0; i Date: Sat, 6 May 2017 16:36:43 +0900 Subject: [PATCH 2/2] pointer --- calc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calc.c b/calc.c index edf6cbd..0fd54d9 100644 --- a/calc.c +++ b/calc.c @@ -1,6 +1,6 @@ #include #include "operators.h" - + int main(){ FILE *fp = NULL; double operand1, operand2;