Output the char's ASCII code : Console Output Char « Console « C / ANSI-C






Output the char's ASCII code

#include <conio.h>
#include <stdio.h>

int main(void)
{
  char ch;

  printf("Enter a char: ");
  ch = getchar();
  printf("\n Its ASCII code is %d", ch);

  return 0;
}
  

           
       








Related examples in the same category

1.Simple printf demo
2.Use getchar() to read user choices
3.Use getche() to receive user selection