Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > refering struct members

Reply
Thread Tools

refering struct members

 
 
safi_m@lycos.co.uk
Guest
Posts: n/a
 
      09-16-2006
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,

 
Reply With Quote
 
 
 
 
Spiros Bousbouras
Guest
Posts: n/a
 
      09-16-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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.

 
Reply With Quote
 
 
 
 
Thad Smith
Guest
Posts: n/a
 
      09-16-2006
(E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
Refering to Object Members in A Collection in an ASP.NET BoundColu =?Utf-8?B?Um9zcyBIb2xkZXI=?= ASP .Net 3 03-10-2006 04:45 PM
ASP.Net 2.0 - refering to the web page class =?Utf-8?B?TmljayBaZHVuaWM=?= ASP .Net 3 02-10-2006 02:10 PM
Refering to web page class from another class =?Utf-8?B?TmljayBaZHVuaWM=?= ASP .Net 1 02-08-2006 02:59 PM
struct my_struct *p = (struct my_struct *)malloc(sizeof(struct my_struct)); Chris Fogelklou C Programming 36 04-20-2004 08:27 AM



Advertisments