Could anyone give me insight on how this is even done?
Could anyone give me insight on how this is even done?
Huh? ASCII is a type of string encoding, just like EBCDIC & Unicode.
If you have an array of ASCII characters, it's a string (as long as it's terminated with a '\0').
"I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008
"the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010
All variables, including char, in a computer are stored as binary values, ie, numbers. That is the purpose of the ASCII standard -- to provide a character set corresponding to numerical values.
The bonus here is that as cpjust points out, all strings are already ASCII values:
Check the output against your ascii table. They're the same.Code:char string[]="hello world"; int i, len = strlen(string); for (i=0; i<len; i++) printf("%d ",string[i]);
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge