-
-
Save davisp/f6b46b4fca28ad9db5ed to your computer and use it in GitHub Desktop.
Apparently char can be an unsigned data type?
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> | |
| int | |
| main(int argc, char* argv[]) | |
| { | |
| fprintf(stderr, "%d\r\n", (char) -1); | |
| fprintf(stderr, "%lu\r\n", sizeof(char)); | |
| } |
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
| $ uname -a | |
| Darwin prism.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 | |
| $ ./a.out | |
| -1 | |
| 1 |
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
| $ uname -a | |
| Linux powerprism 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:09:21 UTC 2014 ppc64le ppc64le ppc64le GNU/Linux | |
| $ ./a.out | |
| 255 | |
| 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment