Hi all,
I am programing in C and i just came across a problem with the pointer to array. I am tring to do a system that has structures like Digital Inputs, Digital Outputs, Analog Inputs exc... All structures have the same charateristics ...
CODE
typedef union
{
structu
{
unsigned bs:1;
unsigned bc:1;
unsigned ba:1;
unsigned ac:1;
}bit;
shor int all;
}DI_Bits;
typedef sruct
{
DI_Bits bits;
UINT16 alm_timer;
UINT16 delay_time;
UINT16 sim_delay;
}DigitalInputs;
Since this are separate structures I put bits in an array that holds just bits and "register" in an array that holds just registers.
CODE
// header file
static short int *bits[20];
static short int *reg[20];
Then i made an object to DigitalInputs structure and ...
CODE
//source file
DigitalInputs DI;
//for bits
static short int *bits = {
&DI.bits.all, // this way I included all other structures that holds the bits
};
// for registers
static short int *bits = {
&DI.alm_timer,
&DI.delay_time,
&DI.sim_delay
};
When I try to compile this with Dev-Cpp, it says that an redelaration occured, while on the Freescale CW just compile this without any problem.
So i am wantering what I did wrong. Since I want to test this with Dev-Cpp before uploading the software on the microchip I am cindly aking you guys for some help.
Thanks and
Best Regards,
BoSCHoW.