 Hello and welcome, this video is part of a series and last video we used this math command to get two integers, any two integers inputted by the user and add them together. The thing is I can come in here and I can type in a letter or two letters and it kind of gives me funky things because we use the scanf function which allows you to grab basically one character. We looked at fgets and also gets to get strings, but if you're just looking for a single character that's what scanf is for and we were using integers and really we should put a check in that program to make sure it's an integer, but as we're talking about today we are going to use scanf again to get a character, but then we're going to get the ASCII value of the character. Now if we go to this website, this is the first website that came up when I searched ASCII table, all the characters that you can type have different ASCII values whether you're talking about HTML, octal, hexadecimal, or decadecimal, decimal, the decimal system. We're going to be looking at getting these decimal values for our different characters and you know things like f, capital F and lowercase f are going to have different values. You can see here f is, lowercase f is 102 and capital f is 70. Let's go ahead and write a code to use that so the user can input it and get the ASCII value of that character. So I already have an empty setup here for some code and here I am going to say in our main function we're going to create a variable, a character variable, char, and we'll call it c for character. Then we'll print f a message here that asks the user to enter a character and then again we'll use scanf just like we did last time to get a single character and we're going to say percent c this time. I think last time we did a percent d because we're looking at numbers. Now we're going to be looking at a character so we're going to say it's going to be a character and we're going to put it in the variable ampersand c which is the character up here that we created. Okay, we're going to get that from the user and then we're going to say print f and here we're going to say ASCII value of and we'll say percent c of our character so that will print out whatever the character is but then we'll also give it a number of the value for that ASCII character, new line and then of course we're going to fill in and in both cases this is going to be the variable c. So one of them is going to be the character itself and the other is going to be the ASCII numeric value. If we create that properly we're going to say gcc the name of our code in this case ASCII.c in our output we'll just say ASCII go ahead and say ASCII which is dot slash is again saying we're writing command that's in this directory and we'll enter a character and we'll do f and it says the value of f equals 102 and that's a lowercase f and if we look at this and we come to f we can see the decimal value for that ASCII character is 102. We can run that again give it capital F and you can see it says 70 and that matches up with our chart right here 70. Now if we were to run this and we were to give it a couple of characters so let's do fgh you can see it's only going to grab that first character you can put in and it's going to ignore everything after that even if the user you know again typed in a bunch of things we know capital F is 70 it's going to return f equals 70. So that's how you can get the ASCII value at least the decimal value for an ASCII character I guess I should say it's not the ASCII value it's the decimal value for that ASCII character I think would be the proper way to say it. Anyway thank you for watching please visit my website filmsbychrist.com that's Chris Decay there's a link in the description you can search through my videos there you can search through my scripts and notes and programs there and you can also support me either through PayPal or through Patreon and there's links to this stuff in the description of this video as well as a link to this project getlab.com forward slash mail x1000 forward slash my bin capital M capital B and there there's a C folder that has a tutorial folder that has a list of C sample code that goes along with this video series. I thank you for watching and as always I hope that you have a great day.