C Programming Tutorial 19 - Intro to Data Types - Part 1

submitted by mkenny400 on 03/19/18 1

This video is going to introduce the concept of data types. First, let's define data. Data is any piece of information. Think of a variable. Let's say we have a variable called tacos, and the value of this variable is 5. The 5 is a piece of data (datum). Now, each piece of data has an associated data type. A data type is defines how the computer should treat a certain value. As we learned before, integer division is completely different than double division. 5/2 = 2, but 5.0/2 = 2.5. We can group data types into groups that help us understand what they are. The first grouping I would say is called primitive data types. These data types can be considered the building blocks. They cannot be broken down further into new data types. Inside of the primitive data types we have numeric (number) data types, a char data type, and a _Bool data type. Numeric data types are used to store numbers, the char data type is used to store a single character, such as ";" or " ", and the _Bool data type is used to store data in one of two states. These values usually represent true or false, on or off, high or low, yes or no… anything that is binary (two states). The primitive data types are foundational to C programming, but once we get into things you are probably going to want to build more complex data types. So the second category is complex data types. That is where structs come in. A struct allows you to define your very own data type. This means that we could make a more complex data type such as date. Now, when we can actually create a variable that stores a date. So we could do something like: date today; similar to how we can do: int x; We can take all of these puzzle pieces and build things up to more complex things. For example, we can combine multiple structs to make a struct containing structs! A common application of this is a linked list. So starting off the data types are pretty simple, but once we get into things we can make some very cool stuff with some custom data structures. Some languages have what are known as objects, which are very similar to structs, but C does not have object oriented programming, so you don't even have to worry about that. Learn structs well and they will help you understand objects when you learn other languages like C++ or objective C. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 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)

×