00001: #include <stdio.h>
00002:
00003: int main() {
00004: int i;
00005: int x;
00006: unsigned int y;
00007:
00008: printf("-1 signed and unsigned\n");
00009: x = -1;
00010: printf("%d %u\n", x, x);
00011:
00012:
00013: printf("\ngoing up\n");
00014: x = 1;
00015: y = 1;
00016: for (i=0; i<=32; i++) {
00017: printf("%12d %12u\n", x, y);
00018: x <<= 1;
00019: y <<= 1;
00020: }
00021:
00022: printf("\ngoing down\n");
00023: x = 1<<31;
00024: y = 1<<31;
00025: for (i=0; i<=32; i++) {
00026: printf("%12d %12u\n", x, y);
00027: x >>= 1;
00028: y >>= 1;
00029: }
00030: return 0;
00031: }
00032:
|