P
pauldepstein
This is copy-pasted from cplusplus.com:
BEGINNING OF QUOTE
void * memset ( void * buffer, int c, size_t num );
Fill buffer with specified character.
Sets the first num bytes pointed by buffer to the value specified by
c parameter
END OF QUOTE
Since we are filling the buffer with a specified _character_, why is
the 2nd parameter an int instead of a char?
Yes, I know that chars are really ints but it still seems a confusing
definition, and I'd greatly appreciate it if someone could explain why
the authors of this function didn't choose type char for the 2nd
parameter.
Also, could someone explain what happens when c == 0?
Thank you,
Paul Epstein
BEGINNING OF QUOTE
void * memset ( void * buffer, int c, size_t num );
Fill buffer with specified character.
Sets the first num bytes pointed by buffer to the value specified by
c parameter
END OF QUOTE
Since we are filling the buffer with a specified _character_, why is
the 2nd parameter an int instead of a char?
Yes, I know that chars are really ints but it still seems a confusing
definition, and I'd greatly appreciate it if someone could explain why
the authors of this function didn't choose type char for the 2nd
parameter.
Also, could someone explain what happens when c == 0?
Thank you,
Paul Epstein