// logical problem // lp0410.c #include #define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0])) int array[] = {23,34,12,17,204,99,16}; int main() { int d; printf("TOTAL_ELEMENTS: %lu %d \n", TOTAL_ELEMENTS, (int) TOTAL_ELEMENTS); for(d=-1;d <= (int) (TOTAL_ELEMENTS-2);d++) printf("%d\n",array[d+1]); /* for(d=0;d < (TOTAL_ELEMENTS);d++) printf("%d\n",array[d]); */ return 0; } /* K&R page 44 or so Conversion rules are more complicated when unsigned operands are involved. The problem is that comparisons between signed and unsigned values are machine-dependent, because they depend on the sizes of the various integer types. For example, suppose that int is 16 bits and long is 32 bits. Then -1L < 1U, because 1U, which is an unsigned int, is promoted to a signed long. But -1L > 1UL because -1L is promoted to unsigned long and thus appears to be a large positive number. */