How to get the Nth digit of an integer with bit-wise operations?
A more efficient implementation might be something like this: char nthdigit(int x, int n) { while (n–) { x /= 10; } return (x % 10) + ‘0’; } This saves the effort of converting all digits to string format if you only want one of them. And, you don’t have to allocate space for … Read more