Simple counters not working in C

ok so for start when using #define x y you simply say “change all the reference to ‘x’ with ‘y'” so when you have

#define C_Range (60-69)

and then

 if (input == C_Range );

it iterputes as

 if (input == (60-69));

which makes no sense, plus you have the “;” at the end of the if statement which doesn’t make sense either

instead use:

#define F_RangeLow 0
#define F_RangeHigh 49

and the if statement

 if (input >= F_RangeLow &&  input <= F_RangeHigh )

now another thing you have to do is to initiate the counter with 0. that’s because you want to stat counting from 0…

float F_Counter=0;

there is no need for 2 “{” at the start of the main
this is quite enough:

int main(int argc, char** argv) {
.
.
.
}

Leave a Comment