memcmp和strncmp的区别
一、memcmp含义
Compare characters in two buffers.
int memcmp( const void* buf1, const void* buf2, size_t count );inline int wmemcmp ( const wchar_t* buf1, const wchar_t* buf2, size_t count);
Parameters
buf1
:
First buffer.
buf2
:
Second buffer.
count
:
Number of characters.
Return Values :
The return value indicates the relationship between the buffers.
Return ValueRelationship of First count Bytes of buf1 and buf2 < 0 buf1 less than buf2 0 buf1 identical to buf2 > 0 buf1 greater than buf2
二、memcmp与strcmp的区别
int memcmp(const void * cs,const void * ct,size_t count)
{
const unsigned char *su1, *su2;
int res = 0;
for( s