I was trying to implement my own strncmp in native C, then I started doing some tests like this one
#include <string.h>
#include <stdio.h>
printf("%d\n", strncmp("test\200", "test\0", 6));
And the return of strncmp in this particular situation was 1; can anyone explain me why?
I'm pretty sure it's because \200 exceeds default ASCII, then I implemented a condition that if the char is not between 0 and 127 I would return 1, is this right?
Per man page:
The numeric value is otherwise undefined.
This means
\200is greater than\0(end of string) which more concisely would be written as: