array declaration

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • new

    array declaration

    struct abc
    {
    int x;
    char y;
    };

    struct xyz
    {
    struct abc p[0]; //LINE 1
    int q;
    };

    int a[0]; //LINE 2

    Are the declarations in line 1 and line 2 correct?

    Please help.

    Thank you.
  • Keith Thompson

    #2
    Re: array declaration

    new <luvraghu@gmail .comwrites:
    struct abc
    {
    int x;
    char y;
    };
    >
    struct xyz
    {
    struct abc p[0]; //LINE 1
    int q;
    };
    >
    int a[0]; //LINE 2
    >
    Are the declarations in line 1 and line 2 correct?
    No. An array must have at least one element.

    Incidentally, you should always indent your code to reflect its
    structure.

    --
    Keith Thompson (The_Other_Keit h) <kst-u@mib.org>
    Nokia
    "We must do something. This is something. Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

    Comment

    Working...