C Programming Tutorial 24 - ASCII

submitted by mkenny400 on 03/19/18 1

We are now going to begin our discussion of the char data type. Now, char is short for character. A character is any number, letter, or symbol that can be used on a computer. That's not all of the characters, though. There are actually some characters that do certain things. For example, there is a tab character, there is a newline character, there is a space character, there is even a null character. A null is the absence of something. So yes, the null character is literally a character that is nothing. But it is still a very important character as we will see later. There are many different types of characters.   How do we know what is a character or not? Well, there is a collection of allowed characters. This is known as a character set. The character set that I am going to be teaching you about today is called ASCII.   Now, before we dive into ASCII, I wanted to discuss something called binary. When I say binary, you should automatically think of something that is in two states. Binary is the most fundamental way that the computer stores information.   Imagine that we have a number, and this number has only two states. The possible values we could use are 0 and 1. This is called a bit. a single bit can be used to represent anything that is in two states, such as on or off, high or low, hot or cold, she loves me or she loves me not, etc.   Well, computers use binary to store information. If we have a bunch of zeros or ones we can start to build more complex information. We will often have groups of bits. One of the most common sized group of bits is called a byte, which is 8 bits. For example, we could have 01000001.   Now, back to ASCII. ASCII will use this to represent 1 character. So 010000001 represents the character A.   Now, the standard ASCII character set is only going to use 7 of the 8 bits. Sometimes it will use 8 and this is known as extended ASCII. With 7 available bits we can have a total of 128 possible characters. This includes the entire English alphabet (capital and lower case), all numbers, a bunch of symbols, and some special characters such as the newline character.   Now, how does the computer know that 01000001 is A? This has to do with how the binary is interpreted. That's because this binary number could just as easily be a way to represent some number. In fact, if this was considered an integer, this number is 65.   So you can directly convert between binary and integer data. Every ASCII character can be represented as a number. In the next videos we will be using the char data type and learning more about converting between char and int. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me! www.patreon.com/calebcurry Subscribe to my newsletter: eepurl.com/-8qtH Donate!: bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: CalebCurry.com Facebook: www.facebook.com/CalebTheVideoMaker Google+: plus.google.com/+CalebTheVideoMaker2 Twitter: twitter.com/calebCurry Amazing Web Hosting - www.dreamhost.com/r.cgi?1487063 (The best web hosting for a cheap price!)

Leave a comment

Be the first to comment

Collections with this video
Email
Message
×
Embed video on a website or blog
Width
px
Height
px
×
Join Huzzaz
Start collecting all your favorite videos
×
Log in
Join Huzzaz

facebook login
×
Retrieve username and password
Name
Enter your email address to retrieve your username and password
(Check your spam folder if you don't find it in your inbox)

×