sp****@gmail.co m wrote:
What is strcmp supposed to return if one or both arguments passed to it
are NULL ?
It isn't.
If either argument to strcmp is null, the behaviour is undefined.
So it may return -1, or 1, or 0, or 17, or 1829. It may generate some
kind of signal. It may exit, increment arbitrary memory, or call
some random one of your functions. Anything: the C standard places
no restrictions on strcmp if either argument is null; there is no
"supposed".
Typically, the behaviour is constrained by other standards and
mechanisms obeyed and performed by your implementation, so you'd
better hope that /they/ are working for you.
Are you willing to bet your nose on it?
--
Chris "one nostril at a time" Dollin
"I'm still here and I'm holding the answers" - Karnataka, /Love and Affection/