Click here to Skip to main content
15,903,030 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
I was trying to print complete ascii chart . Meanwhile I saw this code on tutorialsschool.com website .

#include<stdio.h>
void main() {
int i;
for(i=0;i<=255;i++){
printf("%d->%c\n",i,i);
}
}
It looks perfect , but the problem is that it is not printing symbols for locations such as 7,8,9,10 and 32. I am really confused why it not printing values at those locations.Is it the problem of codeblock.What possibly could be the other program to print these ascii symbols.

What I have tried:

I've tried this program on codeblock IDE . I vave also tried running this program on online compiler And online compilers are giving some weird output.
Posted
Updated 12-Dec-16 8:52am
v3
Comments
[no name] 12-Dec-16 13:28pm    
Non printable characters are called non-printable for a really good reason.
CPallini 12-Dec-16 16:35pm    
Exactly!
My virtual 5.

The low ascii codes, up to the space character, are represented by names Nul, SOH etc. as they were used as control characters.

Depending on your output device and the font used you may not see a character representation.
 
Share this answer
 
Chars are using the ASCII coding
ASCII - Wikipedia[^]
ASCII chars from 0 to 31 are control codes which mean that basically, they don't print. On PC some of those can be printed, it is a legacy from MS-DOS and original IBM-PC.
ASCII char 32 is the space so it is printed but you see nothing, it is its purpose.

Adcise: print to a file, and open with a programmers editor and switch display to Hex mode, you will see that every char is here but some off the don't display in screen, and others have special effect .
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900