I am currently writing a C program that requires frequent comparisons of string lengths so I wrote the following helper function:
int strlonger(char *s1, cha
strlen returns a size_t which is a typedef for an unsigned type.
strlen
size_t
typedef
unsigned
So,
(unsigned) 4 - (unsigned) 7 == (unsigned) - 3
All unsigned values are greater than or equal to 0. Try converting the variables returned by strlen to long int.
0
long int