Last active
February 1, 2019 15:18
-
-
Save Tricky1975/0b50b8c39d709304f717317ce61fba9a to your computer and use it in GitHub Desktop.
A very simple program in C that quickly gets all signed chars from 0 till 255 and their unsigned counter parts and hex code.
This file contains 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> | |
typedef | |
union | |
mc { | |
char rc; | |
unsigned char uc; | |
} mychar; | |
mychar ch; | |
int main() { | |
ch.uc=0; | |
for (int i=0;i<256;i++){ | |
printf("unsigned %3d; signed %4d; hex %0X\n",ch.uc,ch.rc,ch.uc); | |
ch.uc++; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment