linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Wen Guangcheng" <wen.guangcheng@cnt.sp.qnes.nec.co.jp>
To: linux-c-programming@vger.kernel.org
Subject: Question on memcpy()
Date: Wed, 15 Sep 2004 20:17:11 +0900	[thread overview]
Message-ID: <011b01c49b15$8bd3f980$de01a8c0@voip> (raw)
In-Reply-To: 20040915083340.19367.qmail@web52710.mail.yahoo.com

Hello Gurus,

I am trying to fix a bug in a  code. I found something like this,

struct sample A, B;
...
...
memset(&A, 0, sizeof(sample));
memcpy(&A, (char *)&B, sizeof(sample));
...
I could not understand why the second argument is (char *)&B, but not &B.
I think it should be &B. 

Sometimes I found A is all zero. but B is not all zero in fact.  
Is it due to the second argument (char *)&B?

Any comment is appreciated and thanks in advance.

Best regards,

--Wen


  reply	other threads:[~2004-09-15 11:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-15  8:33 RedHat Itanium 64 GCC 3.2.3 linking problems sheetal fegde
2004-09-15 11:17 ` Wen Guangcheng [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-09-15 14:14 Question on memcpy() Huber, George K RDECOM CERDEC STCD SRI
2004-09-15 14:34 ` Charlie Gordon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='011b01c49b15$8bd3f980$de01a8c0@voip' \
    --to=wen.guangcheng@cnt.sp.qnes.nec.co.jp \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).