Skip to main content
Added missing minus sign.
Source Link
Edgar Bonet
  • 45.2k
  • 4
  • 42
  • 81

You can not create a number with arbitrary upper and lower limits. It is common in the C language to create an integer comprised of 16 bits. Such an integer has a minimum of:

-(2^15) = -32768

...and maximum of:

(2^15) - 1 = +32767 

Instead, after pressing the positive button, consider testing if "total_value" is 5 and skipping adding 1 to "total_value" if TRUE. Conversely, after pressing the negative button, consider testing if "total_value" is -5 and skipping subtracting 1 from "total_value" if TRUE.

You can not create a number with arbitrary upper and lower limits. It is common in the C language to create an integer comprised of 16 bits. Such an integer has a minimum of:

(2^15) = -32768

...and maximum of:

(2^15) - 1 = +32767 

Instead, after pressing the positive button, consider testing if "total_value" is 5 and skipping adding 1 to "total_value" if TRUE. Conversely, after pressing the negative button, consider testing if "total_value" is -5 and skipping subtracting 1 from "total_value" if TRUE.

You can not create a number with arbitrary upper and lower limits. It is common in the C language to create an integer comprised of 16 bits. Such an integer has a minimum of:

-(2^15) = -32768

...and maximum of:

(2^15) - 1 = +32767 

Instead, after pressing the positive button, consider testing if "total_value" is 5 and skipping adding 1 to "total_value" if TRUE. Conversely, after pressing the negative button, consider testing if "total_value" is -5 and skipping subtracting 1 from "total_value" if TRUE.

Source Link
st2000
  • 7.5k
  • 2
  • 13
  • 20

You can not create a number with arbitrary upper and lower limits. It is common in the C language to create an integer comprised of 16 bits. Such an integer has a minimum of:

(2^15) = -32768

...and maximum of:

(2^15) - 1 = +32767 

Instead, after pressing the positive button, consider testing if "total_value" is 5 and skipping adding 1 to "total_value" if TRUE. Conversely, after pressing the negative button, consider testing if "total_value" is -5 and skipping subtracting 1 from "total_value" if TRUE.