17 Apr
2014
17 Apr
'14
5:12 p.m.
[net is down here right now; this may take a while to get out... -JimC]
"WS" == Warren D Smith <warren.wds@gmail.com> writes:
x AND y is true iff both are > 0.
WS> --at least with C's meaning of AND, WS> 1 AND 2 = 0, Try this: #include <stdio.h> #include <stdlib.h> int main (int c, char *v[]) { unsigned long x, y, lz, bz; if (c < 3) { fprintf (stderr, "Useage: %s <int> <int>\n", v[0]); return -1; } x = strtol (v[1], NULL, 0); y = strtol (v[2], NULL, 0); bz = x & y; lz = x && y; printf ("%lu & %lu = %lu (%s)\n%lu && %lu = %lu (%s)\n", x, y, bz, bz ? "true" : "false", x, y, lz, lz ? "true" : "false"); } -JimC -- James Cloos <cloos@jhcloos.com> OpenPGP: 1024D/ED7DAEA6