Here is source code of the C Program to input a string & store their ascii values and print them. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C Program to Input a String & Store their Ascii Values in an Integer Array & Print the Array
int n, count = 0;
printf("Enter the no of characters present in an array \n ");
printf(" Enter the string of %d characters \n" , n);
while (count < n)
printf(" %c = %d\n", string[count], string[count] );
++ count ;
$ cc pgm84.c $ a.out Enter the no of characters present in an array 10 Enter the string of 10 characters sanfoundry s = 115 a = 97 n = 110 f = 102 o = 111 u = 117 n = 110 d = 100 r = 114 y = 121
Sanfoundry Global Education & Learning Series – 1000 C Programs.