ASCII value in C Language

ASCII is a character encoding standard that assigns unique numeric values to characters. It was developed to facilitate the exchange of information between different computer systems and devices. In ASCII, each character is represented by a 7-bit binary number, allowing a total of 128 different characters. In this tutorial, we will explore ASCII and provide code examples to display ASCII codes from 0 to 127 using a loop.

In C, characters are represented by their corresponding ASCII codes. We can use a loop to iterate through the ASCII codes and print the characters associated with them. Let's take a look at an example:

In the above example, we use a for loop to iterate from 0 to 127. Inside the loop, we print the ASCII code and its corresponding character using the %c format specifier in the printf() function. Running this program will display all the ASCII characters and their corresponding codes.

Output:

Note that the ASCII codes 0 to 31 represent control characters, which are non-printable characters used for control purposes. The printable characters start from ASCII code 32, with space being the first printable character.

By using a loop to iterate through the ASCII codes, we can explore the complete ASCII character set and observe the corresponding characters associated with each code.