Tim Streater
11/5/2009 5:13:00 PM
In article <hcurbg$jej$1@news.eternal-september.org>,
Richard <rgrdev_@gmail.com> wrote:
> Tim Streater <timstreater@waitrose.com> writes:
>
> > In article
> > <ee58ab7e-f6b4-4f81-9b18-1f53c6cfc882@w19g2000yqk.googlegroups.com>,
> > phaedrus <orion.osiris@virgin.net> wrote:
> >
> >> On Nov 5, 12:56Â pm, bert <bert.hutchi...@btinternet.com> wrote:
> >>
> >> > No, I don't think that's right. Â An array can't store data; the
> >> > data is stored in its individual ELEMENTS. Â A struct can't store
> >> > data; the data is stored in its individual FIELDS. Â The elements
> >> > of the array are referenced by their subscripts; the fields of
> >> > the struct are referenced by their names. Â There's a difference,
> >> > but I think it's a much smaller difference than you think it is.
> >> > --
> >>
> >> OK, point taken. Let me clarify, then.
> >>
> >> The data in an array is stored in its elements.
> >> The data for a struct is stored in the member fields of a structure
> >> VARIABLE.
> >>
> >> Is that correct?
> >
> > As I recall, if I do:
>
> Why is everything "as you recall"?
Because I haven't used C for 20 years, as I've pointed out before. Sit
up straight etc etc.
> > struct wiggy
> > {
> > int a;
> > int b;
> > }
> >
> > Then I've reserved some actual space (two ints-worth). But you can also
> > do:
> >
> > typedef struct wiggy
> > {
> > int a;
> > int b;
> > }
> >
> > which just defines a new type, wiggy, and reserves no space. It's not
> > until later that I do:
> >
> > int p;
> > int q;
> > wiggy diggy;
> >
> > that I've now reserved space for 4 ints.
> >
> > I *think* that's what I used to do.
>
> Why would you offer advice in group of C specialists if you only "think"
> that's what you used to do?
Why shouldn't I? If I'm wrong, (certainly not excluded, see above) then
I expect I'll be corrected by those who know better.
Happy now?
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689