Get sizeof individual array member

Hi,
I need to get the length of each string within an array of strings.
Following code just returns 2 for each line.
Any suggestions?

#define NUMLINES 4

char *lines[NUMLINES] = 
{
 "The way back\t",
 "Space Fall\t",
 "Cygnus Alpha\t",
 "Time Squad\t"  
};

void setup() 
{
 Serial.begin(19200);

 for(int i = 0 ; i < NUMLINES; i++)
 {
   Serial.print(lines[i]);
   Serial.println(sizeof(lines[i]));
 }
}

void loop(void){}

Thanks

Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the “Code” button above the posting area (It looks like a scroll with < > inside it).

Following code just returns 6 for each line.

Not on my Uno it doesn't:

The way back    2
Space Fall  2
Cygnus Alpha    2
Time Squad  2

Ok 2 then.

Point is its the same value.

Cheers

markl859:
Ok 2 then.

Point is its the same value.

Cheers

Because… That is not an array of strings, it is an array of pointers to strings, and a pointer, in AVR, is two bytes.

Regards,
Ray L.

If you want the length of the strings, use strlen.

Thank you Nick,

Been a while since i used C.

You have saved my sanity.

Regards, Mark