#include <stdio.h>
int main()
{
int i = -13;
if ((i / 2) == (i >> 1))
printf("yes\n");
else
printf("no\n");
return 0;
}
The output is no.
int main() { unsigned int ui = 2147483647; if (ui + 1 > 0) printf("ui + 1 > 0\n"); if (ui + 1 < -1) printf("ui + 1 < -1\n"); return 0; }The output.
C:\SVN\book\C>a.exe ui + 1 > 0 ui + 1 < -1
int main() { int i = 2147483647; unsigned int ui = 2147483647; if (i + 1 < 0) printf("i + 1 < 0\n"); if (ui + 1 > 0) printf("ui + 1 > 0\n"); if (ui + 1 > i + 1) printf("ui + 1 > i + 1\n"); return 0; }The output.
C:\SVN\book\C>a.exe i + 1 < 0 ui + 1 > 0