how can i access the array of (void) pointer inside a
structure???
e.b ???
- is this correct manner of accessing???
Read-Only
Author Mike Kleshov
Posted 29-Dec-2011 07:55 GMT
Toolset None
RE: accessing array of ptr in the structures
Mike Kleshov
You seem to be confused about very basic things in C programming.
Read a book on C. K&R is a good one.
Read-Only
Author Per Westermark
Posted 29-Dec-2011 13:05 GMT
Toolset None
RE: accessing array of ptr in the structures
Per Westermark
The big issue is what you intend to do with your void pointers?
Just store generic addresses or abuse them by typecast them to a lot
of different types depending on time of day or your mood?
Most probably, you are running headlong into a very bad
design.
Read-Only
Author Dan Henry
Posted 29-Dec-2011 16:31 GMT
Toolset None
RE: accessing array of ptr in the structures
Dan Henry
"e.b ???
- is this correct manner of accessing???"
No, 'e' is a type, not an object that can be accessed.
Read-Only
Author Per Westermark
Posted 29-Dec-2011 21:39 GMT
Toolset None
RE: accessing array of ptr in the structures
Per Westermark
"No, 'e' is a type, not an object that can be accessed."
The use of typedef together with structures almost always results
in confusion for beginners. How it can be possible to give a name
both before and after the struct, and still not end up with a
variable of that type.
Read-Only
Author Dan Henry
Posted 31-Dec-2011 00:01 GMT
Toolset None
RE: accessing array of ptr in the structures
Dan Henry
"The use of typedef together with structures almost always
results in confusion for beginners."
My observation has been that beginners tend to overuse typedef
without questioning the merits of using typedefs versus explicit
structs. This is only my opinion; in instances where the user doesn't
really care about or access a structure's members (e.g. FILE in
stdio.h) typedef'ing a struct has merit, but if a user's code
accesses members using "." or "->" operators, I don't see the
value in hiding an object's "structness" behind a typedef name.
Again, that's just my opinion, but I might remember it also being the
opinion of pundits on comp.lang.c.
Read-Only
Author Hans-Bernhard Broeker
Posted 31-Dec-2011 10:28 GMT
Toolset None
RE: accessing array of ptr in the structures
Hans-Bernhard Broeker
I believe the reason most people prefer to typedef every struct,
union and enum is the same that drives a good part of C's syntax:
brevity. People want to be able to just write "foo" instead of
"struct foo" every time they use one.
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.