For loop getting stuck

Hey all,
I have wrote program for looping two seven segment displays to read from 00 to FF. The problem is my for loop gets stuck and I am unsure why. It counts the ones up until 10 then stays on 0 for the ones digit. Seems like it must be something dumb I am missing but I can't seem to see it. The code is as follows

/*Define Teensy Pins*/
#define A 11
#define B 12
#define C 7
#define D 6
#define E 5
#define F 10
#define G 9
#define H 8
#define ONES 16
#define TENS 17

/*Each segment of display*/
int segments [8] = {A, B, C, D, E, F, G, H};

/*Numbers*/
char zero [8] = {LOW, LOW, LOW, LOW, LOW, LOW, HIGH, HIGH};
char one [8] = {HIGH, LOW, LOW, HIGH, HIGH, HIGH, HIGH, HIGH};
char two [8] = {LOW, LOW, HIGH, LOW, LOW, HIGH, LOW, HIGH};
char three [8] = {LOW, LOW, LOW, LOW, HIGH, HIGH, LOW, HIGH};
char four [8] = {HIGH, LOW, LOW, HIGH, HIGH, LOW, LOW, HIGH};
char five [8] = {LOW, HIGH, LOW, LOW, HIGH, LOW, LOW, HIGH};
char six [8] = {LOW, HIGH, LOW, LOW, LOW, LOW, LOW, HIGH};
char seven [8] = {LOW, LOW, LOW, HIGH, HIGH, HIGH, HIGH, HIGH};
char eight [8] = {LOW, LOW, LOW, LOW, LOW, LOW, LOW, HIGH};
char nine [8] = {LOW, LOW, LOW, HIGH, HIGH, LOW, LOW, HIGH};

/*Hex Letters*/
char a [8] = {LOW, LOW, LOW, HIGH, LOW, LOW, LOW, HIGH};
char b [8] = {HIGH, HIGH, LOW, LOW, LOW, LOW, LOW, HIGH};
char c [8] = {LOW, HIGH, HIGH, LOW, LOW, LOW, HIGH, HIGH};
char d [8] = {HIGH, LOW, LOW, LOW, LOW, HIGH, LOW, HIGH};
char e [8] = {LOW, HIGH, HIGH, LOW, LOW, LOW, LOW, HIGH};
char f [8] = {LOW, HIGH, HIGH, HIGH, LOW, LOW, LOW, HIGH};

/*Pattern*/
char * phrase [] = {zero, one, two, three, four, five,
                    six, seven, eight, nine, a, b, c, d, e, f};

void setup()
{
  pinMode(A, OUTPUT);
  pinMode(B, OUTPUT);
  pinMode(C, OUTPUT);
  pinMode(D, OUTPUT);
  pinMode(E, OUTPUT);
  pinMode(F, OUTPUT);
  pinMode(G, OUTPUT);
  pinMode(ONES, OUTPUT);
  pinMode(TENS, OUTPUT);
}

void loop()
{ 
  /*Counters*/
  int i = 0;/*Tens*/
  int k = 0;/*Ones*/
  
  for (i = 0; i < sizeof(phrase); ++i)
  {
    for (k = 0; k < sizeof(phrase); ++k)
    {
      /*Change to tens column*/
      digitalWrite(ONES, HIGH);
      digitalWrite(TENS, LOW);      
            
      lightUp(i);      
            
      /*Change to ones column*/
      digitalWrite(TENS, HIGH);
      digitalWrite(ONES, LOW);
      
      lightUp(k);
    }
    k = 0;
    }
}

void lightUp(int cur)
{
  int j = 0;
  
  for (j = 0; j < 8; ++j)
  {
    digitalWrite(segments[j], phrase[cur][j]);
  }
  delay(17);     
}

Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

I am not sure here but it looks like your first for loop is not doing anything just looking into the second and ones that is done then it finishes

sizeof(phrase) is the number of bytes in the phrase array - not the number of entries.
Try sizeof(phrase)/sizeof(phrase[0])

Pete

The outer for loop was intended for the tens section while the inner is for the ones. The lightUp function was being called with the tens followed by the ones so that it would appear as 01 02 03 04 05 and so on. The tens only incremented once the ones reached F. I did solve the problem by changing the function entirely but I am still curious as to why the nested for loop did not work if anyone has an answer. Below is how I fixed the problem encase anyone is interested.

void loop()
{
/Counter/
int i = 0;

for(i = 0; i < 255; ++i)
{
digitalWrite(ONES, HIGH);
digitalWrite(TENS, LOW);

lightUp(i / 16);

digitalWrite(TENS, HIGH);
digitalWrite(ONES, LOW);

lightUp(i % 16);
}
}

el_supremo:
sizeof(phrase) is the number of bytes in the phrase array - not the number of entries.
Try sizeof(phrase)/sizeof(phrase[0])

Pete

Thanks Pete that makes a lot of sense. I will have to try it out next time I fire it up.

/*Hex Letters*/
char a [8] = {LOW, LOW, LOW, HIGH, LOW, LOW, LOW, HIGH};
char b [8] = {HIGH, HIGH, LOW, LOW, LOW, LOW, LOW, HIGH};
char c [8] = {LOW, HIGH, HIGH, LOW, LOW, LOW, HIGH, HIGH};
char d [8] = {HIGH, LOW, LOW, LOW, LOW, HIGH, LOW, HIGH};
char e [8] = {LOW, HIGH, HIGH, LOW, LOW, LOW, LOW, HIGH};
char f [8] = {LOW, HIGH, HIGH, HIGH, LOW, LOW, LOW, HIGH};

A word of warning. One letter global variable names are a really bad idea. Far to easy to inadvertently overwrite. A bit more of a challenge when the variable is an array. The numbers from 0 to 9 have names. hexA, hexB, etc. would be in keeping with the named arrays for the first 10 numbers.

/*Define Teensy Pins*/
#define A 11
#define B 12
#define C 7
#define D 6
#define E 5
#define F 10
#define G 9
#define H 8
#define ONES 16
#define TENS 17

The Arduino core code has # define statements for a lot of one letter names. You really don't want to compound that foolishness with one letter names of your own.