Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

array of struct

struct tbl

{

unsigned int Nr[2][3];

} mytbl = {{0,1,2},{1,2,3}};

This doen't work, but why?

For my application mytbl has to be a array (mytl[20]) and it has to be initialized at startup like above.

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi asegers,

    > This doen't work, but why?

    Your initializer syntax is not correct ... each struct member needs its own

    braces ... try:

    struct tbl

    {

    unsigned int Nr[2][3];

    } mytbl = {{{0,1,2},{1,2,3}}};

    Regards,

    --Scott