Home > Back-end >  Merit of signed comparison return of memcmp
Merit of signed comparison return of memcmp

Time:11-15

What is a merit for the signed int return value of memcmp compared to say bool?

I don't think I've ever used the return value of memcmp other than to compare it against zero.

CodePudding user response:

What is a merit for the signed int return value of memcmp

Useful for sorting objects based on their binary representation.

Note: memcmp() returns a ,0,- based on the first mismatched byte as if bytes are unsigned char, not char.

  • Related