KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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, char *s2) { return strlen(s1) - strlen(s2) > 0; } I have noticed that the function returns true even when s1 has shorter length than s2 . Can someone please explain this strange behavior?
Tags (comma-separated)
Save Edits
Cancel