[Ilugc] Structure alignment & Internal Paddin
Binand Sethumadhavan
binand at gmail.com
Sun Aug 13 23:54:57 IST 2006
On 13/08/06, amit saha <dandolls at yahoo.co.in> wrote:
> I am still in the dark about this "anonymous structure".
A normal struct would look like:
struct foo {
int something;
char something_else;
};
And then you can have:
struct foo hello, world;
struct foo *fooptr = hello;
And so on, wherever you want.
An anomymous structure is one that omits the name for the structure;
here foo. It is useful only for one declaration:
struct {
int something;
char somethingelse;
} hello, world;
If you at a later time need another of these structs, you need to
define the struct all over again (for example, the fooptr above). It
is a valid C structure, but its usefulness is dubious. It is so much
easier to follow the first version so as to maintain the structure
definition in one place.
> The question is still though unanswered.
What is the question about the original struct?
Binand
More information about the ilugc
mailing list