isolating a digit

Hi, beware of redefining the num variable within the for block:

    unsigned int num = pgm_read_word_near(preDefLayout +i);
    for (int d=0; d<5; d++)
    {
      unsigned int num= compare%(10^d);

My approach would be: get the highest power of 10 less than the numbers to compare, take the leftmost digits from the numbers using division, compare them, discard the leftmost digit using the modulus operation, get the next lower power of 10, repeat the cycle.

This results in making the comparison from left to right, as in your requirement.

  unsigned long first_number_to_compare, second_number_to_compare;
// here assign some value to the numbers

  unsigned long max_number_to_compare = 
        first_number_to_compare > second_number_to_compare ?
                first_number_to_compare : second_number_to_compare;

// get the highest power of 10 that is less than the highest number
  unsigned long magnitude = 1;
  while (magnitude * 10 < max_number_to_compare)
  {
    magnitude *= 10;
  }

// compare the numbers starting from the leftmost digit
  while (magnitude > 0)
  {
    int first_digit_to_compare = first_number_to_compare / magnitude;
    int second_digit_to_compare = second_number_to_compare / magnitude;
// here compare the digits, print something

// cut off the leftmost digit
    first_number_to_compare %= magnitude;
    second_number_to_compare %= magnitude;
    magnitude /= 10;
}