C Programming | To find ASCII code of a character.

What is the ASCII code?


ASCII code is a specific value provided for every character and is unique.ASCII stands for the American Standard Code for Information Interchange.

Video Tutorial:



It was designed way back in the 1960s, as a standard character set for computers and electronic devices.

The ASCII is a 7-bit character set containing 128 characters.

ASCII contains the numbers from the range of integers 0-9, the upper and lower case English alphabet letters from A to Z, and some of the special characters available.

The character sets that are used computers today, in the HTML programming, and on the Internet, are all based on ASCII(American Standard Code for Information Interchange).

The following tables list the uppercase and lowercase English alphabets' ASCII characters and their equivalent number. 



As you can see in the above two given images the ASCII code for the uppercase and lowercase English alphabets A to Z and a to z are given as an example.
Similarly, there are other characters also available which have certain ASCII codes specified to them.
Now coming to the C program to find the ASCII code of a character these are the following steps that are being taken place in the programming.
First of all, we will define a variable named 'c' which we will use to input the character in the program,
char c;
and along with a print statement asking the user to input any character which he/she wants to find the ASCII code.
printf("enter a character : ");
Now the program will take the character using the ' scanf ' command.
scanf("%c", &c);
Now after this the 'printf' command will print the particular ASCII code for the given character as the input.
printf("ASCII code : %d", c);
As you can see in the code provided below, you can successfully execute the given program and find the ASCII code of any character using the C programming.
A detailed video is also provided, if you feel more comfortable watching the videos, do watch them. I hope it will help you surely :-)

C Programming to find the ASCII code of a character.



Post a Comment

0 Comments