473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

refering struct members

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 '06 #1
2 1317
sa****@lycos.co.uk 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.

Sep 16 '06 #2
sa****@lycos.co.uk 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
Sep 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Steve | last post by:
I'll be the first to admit, I'm not entirely clear on the appropriate usage of either. From what I am reading in my books, a Struct and a Class are pretty much the same, with the difference being,...
5
by: Rick | last post by:
Hi, Another question for today, it's about structs refering to each other. I tried this code struct List; struct child { struct List parent; };
19
by: Yoon Soo | last post by:
Hi, there while mixing assembler and c code I got the following question: struct bar { int bar_val1; int bar_val2; (...) }
21
by: hermes_917 | last post by:
I want to use memcpy to copy the contents of one struct to another which is a superset of the original struct (the second struct has extra members at the end). I wrote a small program to test...
7
by: Urs Wigger | last post by:
In a C++ project, I have the following struct definition: struct GridModeDataT { double dVal1; double dVal2; double dVal3; long ...
5
by: Chris | last post by:
Hi, I don't get the difference between a struct and a class ! ok, I know that a struct is a value type, the other a reference type, I understand the technical differences between both, but...
5
by: Bill Pursell | last post by:
Suppose I have a structure with many members, and I pass a pointer to that structure to a function. I'd like the prototype of the function to specify that it will only be changing certain members...
4
by: Michael Brennan | last post by:
I have a menu_item structure containing an union. func is used if the menu item should use a callback, and submenu if a popupmen should be shown. struct menu_item { enum { function, popup }...
12
by: Milux | last post by:
Hi All, This question has to do with interface design. Suppose I have an translation tool. It can translates structs from type "general" to other types and then does some processing. Example:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.