Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned char* returnString(unsigned char inputValue)
- {
- static unsigned char processedString[4];
- unsigned char firstDigitCounter = 0;
- unsigned char secondDigitCounter = 0;
- if (inputValue > 99)
- {
- while (inputValue > 99)
- {
- inputValue -= 100;
- firstDigitCounter++;
- }
- while (inputValue > 9)
- {
- inputValue -= 10;
- secondDigitCounter++;
- }
- processedString[0] = firstDigitCounter + 0x30;
- processedString[1] = secondDigitCounter + 0x30;
- processedString[2] = inputValue + 0x30;
- processedString[3] = '\0';
- }
- else
- {
- while (inputValue > 9)
- {
- inputValue -= 10;
- secondDigitCounter++;
- }
- processedString[0] = secondDigitCounter + 0x30;
- processedString[1] = inputValue + 0x30;
- processedString[2] = '\0';
- }
- return processedString;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement