copx wrote:
Is the "-" operator (meaning * (-1) ) part of the standard?
Yes (C&V 6.5.3). It's called "unary minus" (same as in maths, really).
Example program:
#include <stdio.h>
int main(void)
{
int a = -5;
printf("%d", -a); /* should print 5 */
return 0;
}
Is that portable?
No, as you did not terminate `printf` with '\n'. Not doing so makes it
possible for a conforming implementation to do anything, including not
printing out any characters at all. ;-)
As for a unary `-`, yes, it is.
Cheers
Vladimir
--
That woman speaks eight languages and can't say "no" in any of them.
-- Dorothy Parker