Created
September 21, 2010 04:01
-
-
Save inklesspen/589164 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdint.h> | |
| #include <inttypes.h> | |
| int main(void) | |
| { | |
| uint32_t a = UINT32_MAX - 10; | |
| printf("%" PRIi32 "\n", a); | |
| printf("%" PRIu32 "\n", a); | |
| int32_t b = (int32_t) a; | |
| printf("%" PRIi32 "\n", b); | |
| printf("%" PRIu32 "\n", b); | |
| int32_t c = b + 100; | |
| printf("%" PRIi32 "\n", c); | |
| printf("%" PRIu32 "\n", c); | |
| uint32_t d = a + 100; | |
| printf("%" PRIi32 "\n", d); | |
| printf("%" PRIu32 "\n", d); | |
| return 0; | |
| } | |
| /* | |
| Output: | |
| -11 | |
| 4294967285 | |
| -11 | |
| 4294967285 | |
| 89 | |
| 89 | |
| 89 | |
| 89 | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment