Johs said:
I need to make some special action if 'a' and 'b' are both positive or both
negative. Is there some inbuilt function to check this?
No, there is no built in function to do this. The best way, in general, to
answer this kind of thing in the future is to take a good reference, such as
the appendix in K&R, and make some personal notes on the various headers.
This will force you to actually read, rather than skim, the contents. Most
everything will fit into some kind of category, but you really need to
study <stdlib.h> because it is a catch all for the residue of what didn't
fit in some neat niche. And <math.h> should be studied as well.
IMO the people that wrote the standard were pretty careful not to innundate
the thing with drivel. I consider something as pointless when it is trivial
and obvious to do it with the basic language. But everyone has their own
personal "trivial" of course. The "pointless" functions along the lines of
what you asked that comes to mind is abs() and fabs(). Some of the stuff
may be trivial but not obvious, ceil() and floor() in <math.h>come to mind.
But in a practical sense this still leaves the question, OK, it is not
standard but "Does *my* compiler have such a function?" For example, there
might be something special to convert "endinadness". I don't have any
particularly helpful hints on that problem. Study and practice, practice,
practice AFAIK.