ASCII
how to get a char [i] to ASCII number
i want to enter a sentence and come out one word at a time
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
/* lab8_1.c */
#include <stdio.h>
#include <string.h>
#include <math.h>
#define SIZE 81
void dispstr (char[]);
int main()
{
char input[SIZE];
printf("Please enter a string: ");
gets(input);
dispstr (input);
return 0;
}
void dispstr (char msg[])
{
int i;
for (i = 0; i>strlen(msg); i++);
{
/*need convet charater to ASCII*/
if (msg[i]==32)
printf("\n");
else
printf("%c", msg[i]);
}
}
|
Last edited on
Topic archived. No new replies allowed.