sizeof always returning 1?

I have a sketch that scrolls text on an LED matrix. I have a scroll function that works fine if you set the string to scroll inside the function like so

void scroll()
{
  char msg[] = "THE OBLIGATORY ARDUINO LED MATRIX PROJECT  ";

But I wanted to pass the string into the function. So I changed it to this:

void Scroll(char *msg, int Speed)
{

it works, but it only scrolls the first letter. I have narrowed it down to this line:

for (int charIndex=0; charIndex < sizeof(msg)-1; charIndex++)

specifically the sizeof function. If I substitute it with a number, it scrolls that many letters. It seems that it always returns a 1 instead of the correct value.
Am I missing something?

Any help is appreciated
ematson5897

You need strlen() not sizeof()

for (int charIndex=0; charIndex < strlen(msg); charIndex++)

Pete

msg is the address of the array, therefore sizeof(msg) is the size of an address (16 bits or 2 bytes on the AVR) and sizeof(msg)-1 is 2 - 1.


Rob