Re: struct problems
- From: nick_keighley_nospam@xxxxxxxxxxx
- Date: Tue, 20 Jan 2009 02:43:35 -0800 (PST)
On 20 Jan, 00:51, Richard <rgrd...@xxxxxxxxx> wrote:
Keith Thompson <ks...@xxxxxxx> writes:
Mark Wooding <m...@xxxxxxxxxxxxxxxx> writes:
"Bill Cunningham" <nos...@xxxxxxxxxxxxx> writes:[...]
struct cat kitty1,kitty2;
kitty1={"striper","striped"};
kitty2={"spook","black"};
And this is the actual problem. You're presumably trying to initialize
these structure variables. You want
struct cat
kitty1 = { "striper", "striped" },
kitty2 = { "spook", "black" };
As a matter of style, I wouldn't declare multiple objects in a single
line line that. I'd write:
struct cat kitty1 = { "striper", "striped" };
struct cat kitty2 = { "spook", "black" };
[...]
His style is far nicer IMO. Why specify the type twice?
Localisation. Compact. Clean.
int* pi, pj;
the person who wrote that might think pj was an int*.
If you want compact use a typedef.
Cat kitty1;
Cat kitty2;
--
Nick Keighley
Every sentence I utter must be understood not as an affirmation,
but as a question.
Niels Bohr
.
- Follow-Ups:
- Re: struct problems
- From: Richard Bos
- Re: struct problems
- From: Richard
- Re: struct problems
- References:
- struct problems
- From: Bill Cunningham
- Re: struct problems
- From: Mark Wooding
- Re: struct problems
- From: Keith Thompson
- Re: struct problems
- From: Richard
- struct problems
- Prev by Date: Re: struct problems
- Next by Date: Re: C vs. C++
- Previous by thread: Re: struct problems
- Next by thread: Re: struct problems
- Index(es):
Relevant Pages
|