pTutorial

New way to learn C programming

C Program to print complete ASCII value

This C Program, prints the complete ASCII value table without using any pre-defined function and below program finds the keys ASCII value.

For Example : The ASCII value of Enter key is 13.

Print Complete ASCII Value Table



#include <stdio.h>
#include <conio.h>
void main()
{
    int i;
  
    printf("Complete ASCII value Table\n");
	
	for(i=0;i<=255;i++)
        
	printf(" character %c: value\t %d\n",i,i);

    getch();
}

Download ASCII Table

In the above example, a for loop is used to print characters and his ASCII value using the format specifier %c for character and %d for integer.

ASCII value of the keys

#include <stdio.h>
#include <conio.h>
void main()
{
char chr;

printf("enter any key :");

chr=getche();

printf("\nASCII value of %c = %d",chr,chr);

getch();
}

Download C Program to Print Key ASCII value

In the above example, getche function is used to get character from the keyboard and print through the printf function as shown above.

See Also

Example angular.php   |   Php sorting of array1   |   Php5 access specifiers

QUOTES OF THE DAY

Eat to live, and not live for eat.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER