There is such a problem. It is necessary to translate the number into the hexadecimal number system. Replacing the numbers 10-16 with letters made in the subroutine through the switch. But after the execution instead of the desired letter, the program returns the code of the letter from ASCI.
How to make it return exactly the letter?
int iftool(char t) { switch (t) { case 0: return t = 0; break; // // ... // case 9: return t = 9; break; case 10: return t = 'A'; break; case 11: return 'B'; break; case 12: return t = ('C'); break; case 13: return t = ('D'); break; case 14: return t = ('E'); break; case 15: return t = ('F'); break; } }
the part that translates from 2nd to 16th system.
l=0; r=1; m=1; n=0; while (l<=k) { n=(n+(number[l]*r)); if ( m%4==0 || l==k) { r=1; m=1; t=n; t=iftool(t); mas[x]=t; n=0; printf ("lol-%d",mas[x]); x++; } else { m++; r=r*2; } l++; }