Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Ian Collins <ian-news@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: #include problem |
| Date | 2011-10-09 16:32 +1300 |
| Message-ID | <9fciu1Ftu8U13@mid.individual.net> (permalink) |
| References | <4e8ef020$0$287$14726298@news.sunsite.dk> <j6q66o$as0$1@speranza.aioe.org> <9fbmjtFtu8U12@mid.individual.net> <j6r3ts$cr4$1@speranza.aioe.org> |
On 10/ 9/11 04:20 PM, Mark wrote:
> "Ian Collins"<ian-news@hotmail.com> wrote:
>> On 10/ 9/11 07:53 AM, Mark wrote:
>>>
>>> Sorry for asking additional questions instead of answering yours: I
>>> often
>>> observe the structures containing a single member, often that is an
>>> array.
>>> What is the reason for doing so?
>>
>> So the array can be copied with one assignment.
>
> But what exactly do you mean by "can be copied with one assignment" ?
>
> struct my
> {
> unsigned int foo[6];
> };
>
> struct my a1 = { {0xa, 0xb, 0xc, 0x1, 0x2, 0x3} };
> struct my a2;
>
> memcpy(&a1,&2, sizeof(struct my));
>
> I still need memcpy, like I would for copying arrays.
No, just write
a2 = 1a;
--
Ian Collins
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
#include problem arnuld <sunrise@invalid.address> - 2011-10-07 12:27 +0000
Re: #include problem Ike Naar <ike@iceland.freeshell.org> - 2011-10-07 12:34 +0000
Re: #include problem arnuld <sunrise@invalid.address> - 2011-10-07 12:47 +0000
Re: #include problem Azazel <azazel@remove.azazel.net> - 2011-10-07 07:37 -0500
Re: #include problem Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-10-07 13:38 +0100
Re: #include problem arnuld <sunrise@invalid.address> - 2011-10-07 13:01 +0000
Re: #include problem Azazel <azazel@remove.azazel.net> - 2011-10-07 08:54 -0500
Re: #include problem "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-10-08 14:53 -0400
Re: #include problem Ian Collins <ian-news@hotmail.com> - 2011-10-09 08:29 +1300
Re: #include problem China Blue Corn Chips <chine.bleu@yahoo.com> - 2011-10-08 13:05 -0700
Re: #include problem "Mark" <mark_cruzNOTFORSPAM@hotmail.com> - 2011-10-08 23:20 -0400
Re: #include problem Ian Collins <ian-news@hotmail.com> - 2011-10-09 16:32 +1300
Re: #include problem James Kuyper <jameskuyper@verizon.net> - 2011-10-09 06:14 -0400
Re: #include problem Ike Naar <ike@sverige.freeshell.org> - 2011-10-09 12:30 +0000
Re: #include problem Nobody <nobody@nowhere.com> - 2011-10-09 13:56 +0100
Re: #include problem James Kuyper <jameskuyper@verizon.net> - 2011-10-09 10:02 -0400
csiph-web