Search code examples
glibcmemcmp

Passing 3rd parameter to memcmp as -1 return 0


For memecmp(), the third parameter is size_t(unsigned). But when we pass third parameter as -1 returns always 0, eventhough the memory block pointed by first and second parameters are different?


Solution

  • What are you comparing? memcmp() returns 0 if the contents in the two memory blocks are equal.