d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > C Language
Add Reply New Topic New Poll
Member
Posts: 4,983
Joined: Jul 19 2014
Gold: 26.60
Feb 11 2016 12:54am
I submitted the assignment already, but can anyone show me a function that calls the ascii table? And let me use in the main program section!
Member
Posts: 2,012
Joined: Sep 23 2007
Gold: 60.00
Feb 11 2016 03:01am
If by "calling" you mean writing down all the characters, there you go:

Code
for (int i = 0; i < 128; i++) {
char c = i;
printf("%d:\t %c\n", i, c);
}


This post was edited by Redo on Feb 11 2016 03:01am
Member
Posts: 1,178
Joined: Oct 28 2009
Gold: 1,389.00
Feb 11 2016 11:13am
Quote (Redo @ 11 Feb 2016 13:01)
If by "calling" you mean writing down all the characters, there you go:

Code
for (int i = 0; i < 128; i++) {
char c = i;
printf("%d:\t %c\n", i, c);
}


You don't need char variable there, just use casting.
Code

printf("%d:\t%c\n", i, (char) i);
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll