Re: Doubt in memcpy() and memset()
- From: "Lew Pitcher" <lpitcher@xxxxxxxxxxxx>
- Date: 6 Dec 2006 05:29:08 -0800
Dead Loop wrote:
Chris Dollin wrote:
memset( void *s, int c, size_t n );
... copies the value of c (converted to an unsigned char)
into each of the first n characters of the object pointed
to by s.
By the way, I'm puzzled about the type of the second parameter.
Why not use (unsigned char) type?
memset(void *s, unsigned char c, size_t n);
Backwards compatibility.
Both memcpy() and memset() were defined back in the day of K&R C. In
the K&R C definition, char was automatically promoted to int when used
as a function argument.
.
- Follow-Ups:
- Re: Doubt in memcpy() and memset()
- From: Random832
- Re: Doubt in memcpy() and memset()
- References:
- Doubt in memcpy() and memset()
- From: Shhnwz.a
- Re: Doubt in memcpy() and memset()
- From: Chris Dollin
- Re: Doubt in memcpy() and memset()
- From: Dead Loop
- Doubt in memcpy() and memset()
- Prev by Date: Re: malloc
- Next by Date: Re: Doubt in memcpy() and memset()
- Previous by thread: Re: Doubt in memcpy() and memset()
- Next by thread: Re: Doubt in memcpy() and memset()
- Index(es):
Relevant Pages
|
|