C Programming Tutorial 19 – Intro to Data Types – Part 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! http://www.patreon.com/calebcurry

Subscribe to my newsletter: http://eepurl.com/-8qtH

Donate!: http://bit.ly/DonateCTVM2.

~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~

More content: http://CalebCurry.com
Facebook: http://www.facebook.com/CalebTheVideoMaker
Google+: https://plus.google.com/+CalebTheVideoMaker2
Twitter: http://twitter.com/calebCurry

Amazing Web Hosting – https://www.dreamhost.com/r.cgi?1487063 (The best web hosting for a cheap price!)

Comments

Ned Martinez-Zavala says:

Awesome! Will you be going over pointers?

Michael Taylor says:

Great tutorial, just be careful with the use of the word ‘atomic’ – which by your definition is derived from primitive types which is incorrect depending on the environment and operations being done.

Atomic is used when dealing with race condition environments (multi-threaded usually) when you do read -> evaluate -> update -> sync to disk for example. You would want operations around the critical piece of code atomic to prevent values in the cpu register to be volatile to change between two operations (usually read – update – write structure).

TL;DR – Atomic operation means an operation that appears to be instantaneous from the perspective of all other threads. You don’t need to worry about a partly complete operation when the guarantee applies when using atomic processed.

five six says:

youre awesome dude hope your life is going well, congratulations on acquiring a job!

Torben Fischer says:

Dude, great stuff – get the simply stuff down, then the harder stuff will reveal itself.

Write a comment

*

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!

Send this to a friend

▷ Other ReviewsVehicles▷ Show Cars▷ Motorbikes▷ Scooters▷ Bicycles▷ Rims & Tires▷ Luxury BoatsFashion▷ Sunglasses▷ Luxury Watches▷ Luxury Purses▷ Jeans Wear▷ High Heels▷ Kinis Swimwear▷ Perfumes▷ Jewellery▷ Cosmetics▷ Shaving Helpers▷ Fashion HatsFooding▷ Chef Club▷ Fooding Helpers▷ Coktails & LiquorsSports▷ Sport Shoes▷ Fitness & Detox▷ Golf Gear▷ Racquets▷ Hiking & Trek Gear▷ Diving Equipment▷ Ski Gear▷ Snowboards▷ Surf Boards▷ Rollers & SkatesEntertainment▷ DIY Guides▷ Zik Instruments▷ Published Books▷ Music Albums▷ Cine Movies▷ Trading Helpers▷ Make Money▷ Fishing Equipment▷ Paintball Supplies▷ Trading Card Games▷ Telescopes▷ Knives▷ VapesHigh Tech▷ Flat Screens▷ Tech Devices▷ Camera Lenses▷ Audio HiFi▷ Printers▷ USB Devices▷ PC Hardware▷ Network Gear▷ Cloud Servers▷ Software Helpers▷ Programmer Helpers▷ Mobile Apps▷ Hearing AidsHome▷ Home Furniture▷ Home Appliances▷ Tools Workshop▷ Beddings▷ Floor Layings▷ Barbecues▷ Aquarium Gear▷ Safe Boxes▷ Office Supplies▷ Security Locks▷ Cleaning ProductsKids▷ Baby Strollers▷ Child Car Seats▷ Remote ControlledTravel▷ Luggages & Bags▷ Airlines Seats▷ Hotel Rooms▷ Fun Trips▷ Cruise Ships▷ Mexico Tours