I'm wondering a way that get only sign in integer value.
How to get a sign in integer value?
Please your help..
what I want is)
int value = 100; ====> result : 1
int value = -100; ====> result : -1
int value = 0; ====> result : 0
int rc = 0x00; //same as int rc = 0; int is a primitive type in both Obj-C and C that specifies an integer, effectively you are initializing the variable. In the C language you must initialize variables otherwise they could be pointing at a random piece of memory.
It's Shorthand writing. In Objective-C, any character , numeric or boolean literal prefixed with the '@' character will evaluate to a pointer to an NSNumber object (In this case), initialized with that value. C's type suffixes may be used to control the size of numeric literals.
Trivial.
int signum(int n) { return (n < 0) ? -1 : (n > 0) ? +1 : 0; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With