The easy way to do it in C is with the C standard library function div();
#include <stdlib.h>
int x = 42; // Some number from 0 to 99
div_t d = div(x, 10);
d.quot is first digit
d.rem is second digit
this method can easily be extended to more digits
int x = 1234; // some number from 0 to 9999
div_t d = div(x, 1000);
d.quot is first digit
d = div(d.rem, 100);
d.quot is second digit
d = div(d.rem, 10);
d.quot is third digit
d.rem is fourth digit