Tim Ahrens

Initializing arrays

Discussion created by Tim Ahrens on Jan 23, 2008
Latest reply on Jan 25, 2008 by Jim Donelson
Hi all,
 
A program that I am working on uses a number of arrays to hold various
items such as time, date, etc.
 
Out of reset, I would like these to be pre-loaded with data which is valid.
 
In reading some information, it is suggested that the following code will
initialize those arrays:
 
static int number[3] = { 5, 7, 2 };
 
however, when I put this in and compile it, I don't see any code that
actually takes the data and puts it into the ram array.
 
Another method that I have tried is placing the following into a
function.  Bear in mind that I have about 400 bytes (in 56 arrays)
 
Time1_day1[0]=0x01;
Time2_day1[1]=0x01;
Time3_day1[2]=0x07;
Time4_day1[3]=0x01;
Time5_day1[4]=0x01;
Time6_day1[5]=0x01;
Time7_day1[6]=0x01;
Time8_day1[7]=0x01;
 
This works fine up until the 39th line (trying to do it brute force),
then I get an error message.
 
Back to the original question:  Is there an easy to initialize an
array with values?
 
Thanks,

Tim

Outcomes