From 1d6a732010d07e90b6f7da8fbee5c1659e16497a Mon Sep 17 00:00:00 2001 From: fdai7514 Date: Tue, 7 Feb 2023 12:23:18 +0100 Subject: [PATCH] refactoring: change variable names and attach descriptive comments in calculatorGetUserInput.c --- src/calculatorGetUserInput.c | 23 ++++++++++++++--------- src/calculatorGetUserInput.h | 5 +++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/calculatorGetUserInput.c b/src/calculatorGetUserInput.c index d38d0bb..2eed445 100644 --- a/src/calculatorGetUserInput.c +++ b/src/calculatorGetUserInput.c @@ -1,20 +1,25 @@ #include "calculatorGetUserInput.h" +// Note: +/* This Function may or may not be implemented in actual program, even if it is merged to the main branch. + If it is temporarily not included in the main Program, then this has a role in future Development of the Project */ -int allowOnly() +int allowOnly() //int allowOnly() is helpful for indirectly testing void calculatorGetUserInput(). { - if( a == 1) + if(a == 1) { - return 1; + return 1; } } -void calculatorGetUserInput(float *x, float *y) +void calculatorGetUserInput(float *num1, float *num2) { - if (allowOnly() == 1) + if (allowOnly() == 1) //only if int allowOnly() returns 1, void calculatorGetUserInput will display the desired output. { - printf("number1: "); - scanf("%f", x); - printf("number2: "); - scanf("%f", y); + printf("number1: "); + scanf("%f", num1); + printf("number2: "); + scanf("%f", num2); } } + + diff --git a/src/calculatorGetUserInput.h b/src/calculatorGetUserInput.h index 49e0b8c..9ec1d32 100644 --- a/src/calculatorGetUserInput.h +++ b/src/calculatorGetUserInput.h @@ -2,7 +2,8 @@ #define CALCULATORGETUSERINPUT_H #include #include -void calculatorGetUserInput(float *x, float *y); -const int a = 1; +void calculatorGetUserInput(float *num1, float *num2); +int allowOnly(); +const int a = 1; //Just a random constant which has a role in testing #endif // CALCULATORGETUSERINPUT_H