This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Initializing array of structs

Hello,

I have an array of structs, which I would like to initialize at startup, but to my surprise this gives me a compiler syntax error:

I do as follows:

typedef volatile struct Timer
{
        BYTE byStatus;
        WORD wValue;
        void (code *pfHandler) (void);

} T_TIMER;

volatile T_TIMER g_aSWTimers[TIMER_NO_OF_TIMERS] =
{
        {
                .byStatus = 0;
                .wValue = 0;
                .pfHandler =  OnIgnoreSpeedTimer;
        },
        {
                .byStatus = 0;
                .wValue = 0;
                .pfHandler =  OnIgnoreFM1Timer;
        }
};

And it gives me a warning saying

"TIMERINTS.C(108): error C141: syntax error near '.'"

Could anyone please point me in the right direction?

Thanking you all in advance.

Best regards
Henrik

0