Created
June 19, 2014 16:51
-
-
Save mr-fool/46101232de2b026e70f4 to your computer and use it in GitHub Desktop.
C printing ascii table without print buffer
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 i=0; // | |
| while (i<=127){ /*227 = total number of asii value*/ | |
| if (i%8==0 ) { | |
| printf("\n"); | |
| } | |
| if ((i<=32) || (i==127) ){ /*Since 1-32 and 127 is non-printable*/ | |
| printf("%c",'.'); /*replace non-printable character with .*/ | |
| i++; /*move forward*/ | |
| } | |
| else { /*if not special case then just print normally*/ | |
| printf("%c",i); | |
| i++; | |
| } | |
| } | |
| printf("\n"); | |
| return 0; /*Keep compiler happy*/ | |
| } |
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
| allFiles: ascii.c | |
| gcc -Wall ascii.c -o ascii.out -lm | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment