I'm using MPLab C18 C compiler and getting a syntax error with this code:
hundreds = unsigned char((tick / 100));
tens = unsigned char((tick - (hundreds * 100)) / 10);
ones = unsigned char((tick - (hundreds * 100) - (tens * 10)));
tick
is an unsigned int
. What I'm attempting is to convert a three digit value over to three individual ASCII values by means of simple division and casting the whole number into my unsigned char
variables.
It looks okay to me but I guess I'm missing something.
铸造在括号中完成:
hundreds = (unsigned char)(tick/100);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.