Char Example

/* prints out ascii value of inputed character */

#include <stdio.h>

int main()
{
   char c;

   do
     {
     printf( "Enter character (q to quit): " );
     scanf( "%c", &c );
     
     if ( c != 'q' )
       {
       printf( "%c has ASCII value %d.\n", c, (int) c );
       }
     }
   while( c != 'q' );

   return 0;
}
 

Next Slide