C Programming Tutorial 26 – ASCII and Int Conversion

Don’t forget to read the last blog on the Char Data Type! Are you new here? Start at the beginning, Intro to C!

In the last two videos I’ve laid the foundation for understanding character data and integer data. Be sure to check those out.

In this blog we are going to be writing a program that will take a character and convert it to an integer.

First, we will cover how to convert from ASCII to an integer. Then, we will convert it back.

The next thing we will do is show that you can do math with characters. That’s because they’re really just numbers in disguise.

Now, let’s try to do some math with characters:

You can see that the \t is actually rendered. Remember how if we want to go to a newline we use \n, well we can also use \t! To actually print a backslash we need to use two back slashes.

Are you ready to learn more? Learn about the _Bool Data Type in the next blog!

Leave a Reply

Your email address will not be published. Required fields are marked *