开发者

C/Objective-C read and get last digit of integer?

开发者 https://www.devze.com 2023-02-01 22:50 出处:网络
How can i get the last digit of an integer (or NSInteger) outputte开发者_如何学运维d to integer?

How can i get the last digit of an integer (or NSInteger) outputte开发者_如何学运维d to integer?

example:

int time = CFAbsoluteGetCurrent();
int lastDigit;


Use modulo:

int lastDigit = time % 10;
0

精彩评论

暂无评论...
验证码 换一张
取 消