What is the difference between memcmp, strcmp and strncmp in C?
In short: strcmp compares null-terminated C strings strncmp compares at most N characters of null-terminated C strings memcmp compares binary byte buffers of N bytes So, if you have these strings: const char s1[] = “atoms\0\0\0\0”; // extra null bytes at end const char s2[] = “atoms\0abc”; // embedded null byte const char s3[] = … Read more