Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How to convert strings into asc numbers in C language
How to convert strings into asc numbers in C language
To convert a string into an ascii code value, you need to convert it into an ASCII code value character by character.

In C language, to output the ASCII code value of a character, you only need to use %d format and printf function to output it. Because in the format of %d, character variables are converted into integers, and the values are ASCII code values.

Write the function as follows:

Invalid? print_asc(const? Charles? *s)

{

while(*s)? printf("%d?" ,* s++);

}