refering struct members

S

safi_m

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,
 
S

Spiros Bousbouras

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.
 
T

Thad Smith

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top