C/Objective-C read and get last digit of integer?
-
14-10-2019 - |
سؤال
How can i get the last digit of an integer (or NSInteger) outputted to integer?
example:
int time = CFAbsoluteGetCurrent();
int lastDigit;
المحلول
Use modulo:
int lastDigit = time % 10;
لا تنتمي إلى StackOverflow