Called data types all right so what are the different types of data that we can work with in our program so I’m gonna show you guys all those different data types right now so a lot of times in C when.
We’re working with data we’re gonna.
Be storing that data inside of variables so I’m just gonna show you guys a bunch of different variables that we can create and all the different types of data that we can store inside of.
Those variables so remember whenever we create a variable and C we have to tell C a couple pieces of information and the first piece of information we need to tell C is what type of data that we want to store.
Inside of that container inside of that variable so let’s talk about the different types of data one of the most basic types of data and probably one of the types of data you’re going to be using the most gonna be numbers there’s actually two very important types of numbers that we can.
Represent in C so the first type is called an integer and an integer is basically a whole number so it’s a counting number right if I was counting on my fingers.
1 2 3 4 5 I’m just counting out whole numbers and I’m not saying like 1 1 and a half to 2.3 like I’m counting in whole numbers and that’s what an integer is so to create an integer.
We could just say int and we’ll give this a name so we could say like age and we could.
Equal to like 40 or something now whenever we want to use an integer in C we always just want to type out the number so you’ll notice I’m not putting quotation marks or parentheses or anything around this I’m.
Number like that and now we actually have our variable age another.
Type of number we can create is a decimal number so this.
Would be a number unlike an integer so it would be like 2.
Point five three eight right it’s a number that has a decimal point associated to it so there’s actually two types of decimal number in C there’s something called a.
Double and there’s something called a float and I’m not gonna get too much into the difference between the two of them but as a beginner to see for the most part you’re just gonna want to use a double so I’m just gonna type out double and this could be like someone’s GPA for example it might.
Can use the double to represent decimal numbers it’s also important to note that I could also represent like the number three so I could just say like 3.0 and that’s gonna be a decimal or I could say 40 point O so the difference between 40 and 40 point O is that forty point O is a double it’s a decimal.
Number and 40 without the decimal point is an integer so that’s something just to keep in mind so you can make this like three point six.
So those are the two basic types of numbers integers and doubles and those are gonna come in handy all the time now the next type of data that we’re gonna want to store or is gonna be characters so in.
C we can store single characters inside of a variable so I could just say CH AR and that stands for character and we could give this a value so maybe it’d be like someone’s grade.
And when we create a character in C we’re basically going to specify the character that.
We want to store inside of single quotation marks so inside of these single quotation marks I could put a letter I could put like.
Lowercase a we could put h c d AF basically you can put any character that you want to store so if I.
Put an A here now this character variable grade is gonna store the single character a inside of it it’s important to note that you.
Can only store one character so I couldn’t put like a whole bunch of characters over here and that’s actually gonna throw an error all we can do is store one single character but these three are the basic data types in C so these are the basic types of information that we can deal with in our C programs and just using these three data types we can represent all sorts of information I also want to talk to you guys about one sort.
Of extra data type and it’s not technically a data type in C it’s technically like a modification of the character data type so you’ll notice when we create a character we can only store one letter one single character inside of it but a lot of times we’re gonna want to represent more than one character so we’re gonna want to represent like a string of characters and generally this is called a string so it’s a collection of.
Characters that are grouped together and we can use this char datatype in order to create a string so I can basically say char I can type out the name of the string that I want to create so I could say like phrase and then after this I can make an open and closed square brackets and this is basically gonna tell see that we want to string a bunch of characters together and what we’re actually doing is creating something called an.
Get into arrays later in the course but just for now know that.
We can create a string of characters by using char specifying the name these open and close square brackets and then.
We can create this using to open and closed quotation marks so instead of these single quotes up here we’re just gonna use double quotes and I could type in like a phrase so I could type in whatever string.
Of text I want here and this will get stored inside of this variable which like I said is technically called an array now it’s important to note that doing something like this or creating this like string of characters is a little bit different from these guys up here so like these variables.
Up here we could modify them we can give them new values but you can’t do stuff like that with this.
So just know that this is like a special type of data and it’s gonna act a little bit differently than these ones up here but that’s one of.
The basics of working with data and those are all the basic datatypes that we’re going to be using in our C programs in this tutorial I want to talk to you guys some more about the print F function so if you’ve been following along with this tutorial we’ve been using an instruction and our C programs called printf and printf basically allows us to print different things out onto the screen in this tutorial we’re going to.