Need help manipulating chars in struct arrays

Hi,

I have an array of structs and want to pick out a single character from a string in the struct. Here's the struct:

typedef struct
{
  int type;
  char times[25];
  byte value;
}
profile;

profile timerArray[8];
timerArray[0]=(profile) {1, "000000000000000001111111",1};

Then I want to test to see if the string is a '0' or a '1':

for (i = 0; i < 8; ++i) //run through the timerarray
{
for (n = 0; i < 24; ++n)
{
if(timerArray[i].times[n]
{
//do something here
}
}
}

I'd really appreciate some help :slight_smile:

== '0'

)

Try this

for (int i = 0; i < 8; ++i) //run through the timerarray
{
     for (int n = 0; i < 25; ++n)
     {
          if(timerArray[i].times[n] == (0 || 1) )
          {
               //do something here
          }
     }
}

Thanks for the replies. I was so sure the problem was with the struct and not a simple error in my IF statement!

Since you've all been so helpful any chance of a pointer on my next problem?

The timerArray struct is hogging lots of RAM. I'm struggling to understand PROGMEM usage. How to I store this struct into progmem OR eeprom and retrieve it again?

-Mike

@moore313

if(timerArray[i].times[n] == ([glow]'[/glow]0[glow]'[/glow] || [glow]'[/glow]1[glow]'[/glow]) )