I am using C as the programming language.
How to ignore the sign when using float/signed int variables?
For example if float/signed int f = -40 or +40
The result should be same after a mathematical operation like a+b*f
I am using C as the programming language. How to ignore the sign when
Share
Use
absfor ints orfabsfor floats.EDIT: It’s not clear wether you want -40 to be treated as 40 or vice versa, if you for some reason wan’t the latter: