refering struct members

Discussion in 'C Programming' started by safi_m@lycos.co.uk, Sep 16, 2006.

  1. Guest

    Hello,

    my question: In case i use the following structs:

    struct odt_entry_size {
    unsigned short address;
    unsigned int size;};

    struct no_of_odt_entries {
    struct odt_entry_size odt_entry [8];};

    struct no_of_odt_entires daq_list[4];

    can i access the member address as below ?

    daq_list[1].odt_entry[3].address

    if am wrong how can this be done?

    thanks in advance for the response,
     
    , Sep 16, 2006
    #1
    1. Advertising

  2. wrote:

    > Hello,
    >
    > my question: In case i use the following structs:
    >
    > struct odt_entry_size {
    > unsigned short address;
    > unsigned int size;};
    >
    > struct no_of_odt_entries {
    > struct odt_entry_size odt_entry [8];};
    >
    > struct no_of_odt_entires daq_list[4];


    I assume here you meant entries rather than entires.

    >
    > can i access the member address as below ?
    >
    > daq_list[1].odt_entry[3].address


    If you fix the typo then it's correct.
     
    Spiros Bousbouras, Sep 16, 2006
    #2
    1. Advertising

  3. Thad Smith Guest

    wrote:

    > my question: In case i use the following structs:
    >
    > struct odt_entry_size {
    > unsigned short address;
    > unsigned int size;};
    >
    > struct no_of_odt_entries {
    > struct odt_entry_size odt_entry [8];};
    >
    > struct no_of_odt_entires daq_list[4];
    >
    > can i access the member address as below ?
    >
    > daq_list[1].odt_entry[3].address


    As noted by "dev", there is a typo. I suggest you get a C compiler, if
    you don't have one, and run sample code through it. You can answer a
    lot of questions that way. One hazard with that, though, is that some
    compilers have extensions that accept constructs outside the standard
    language. Using these makes code non-portable to other compilers and hosts.

    --
    Thad
     
    Thad Smith, Sep 17, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TmljayBaZHVuaWM=?=

    Refering to web page class from another class

    =?Utf-8?B?TmljayBaZHVuaWM=?=, Feb 8, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    446
    Karl Seguin [MVP]
    Feb 8, 2006
  2. =?Utf-8?B?TmljayBaZHVuaWM=?=

    ASP.Net 2.0 - refering to the web page class

    =?Utf-8?B?TmljayBaZHVuaWM=?=, Feb 9, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    1,451
  3. =?Utf-8?B?Um9zcyBIb2xkZXI=?=

    Refering to Object Members in A Collection in an ASP.NET BoundColu

    =?Utf-8?B?Um9zcyBIb2xkZXI=?=, Mar 10, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    488
    =?Utf-8?B?Um9zcyBIb2xkZXI=?=
    Mar 10, 2006
  4. Chris Fogelklou
    Replies:
    36
    Views:
    1,438
    Chris Fogelklou
    Apr 20, 2004
  5. John Reye
    Replies:
    28
    Views:
    1,412
    Tim Rentsch
    May 8, 2012
Loading...

Share This Page