C Programming Tutorial 46 – If Statement 

Did you read the last blog? Go read intro to logic! Are you new here? Start at the beginning, Intro to C!

The if statement is the most foundational flow control statements in programming. You are literally going to come across the if statement in probably every program you see or write. Make sure you watch the previous video as it is foundational to this one.

The if statement is foundational to branching. Branching is when your program only does something based on the truth value of some statement. The if statement can sometimes be called a conditional statement.


Continue reading “C Programming Tutorial 46 – If Statement “

C Programming Tutorial 45 – Intro to Logic

Did you read the last blog? Go read the coding challenge! Are you new here? Start at the beginning, Intro to C!

This blog is going to be an introduction to logic. Now, the term logic can be used for a lot of different things, but in computer science it is specifically talking about things being true or false.

When we claim something, we are making what is known as a statement. A statement is a claim that is either true or false, but not both. This is a little different than statement in computer science which tells the computer to do something. The statement in logic is often called an expression in computer science.


Continue reading “C Programming Tutorial 45 – Intro to Logic”

C Programming Tutorial 44 – Coding Challenge

Did you read the last blog? Go read it on Quiz Part 3! Are you new here? Start at the beginning, Intro to C!

You know a lot of the concepts, but now you need to practice writing some code. I am going to give you a small coding assignment. You can give it a try and then compare your answer to mine.

The Assignment:

You have a right triangle, and you are given the length of the smaller sides. Write a program that asks the user for two lengths of a right triangle, and outputs the length of the longest side (the hypotenuse).


Continue reading “C Programming Tutorial 44 – Coding Challenge”

C Programming Tutorial 43 – Quiz Part 3

Just as a reminder, up next we will be covering logic, conditionals, loops, and how to make more complex programs. But before this, I think it is important to make sure we have the previous blogs down well. These next blogs and previous blog will quiz you on some parts of C. If you have a hard time answering these question, you might want to review your notes. Are you new here? Start at the beginning, Intro to C!


Continue reading “C Programming Tutorial 43 – Quiz Part 3”

C Programming Tutorial 42 – Quiz Part 2

Just as a reminder, up next we will be covering logic, conditionals, loops, and how to make more complex programs. But before this, I think it is important to make sure we have the previous blogs down well. These next blogs and previous blog will quiz you on some parts of C. If you have a hard time answering these question, you might want to review your notes. Are you new here? Start at the beginning, Intro to C!


Continue reading “C Programming Tutorial 42 – Quiz Part 2”

C Programming Tutorial 41 – Quiz Part 1

Did you read the last blog? Go read it on How to use the Type Cast Operator! Are you new here? Start at the beginning, Intro to C!

Up next we will be covering logic, conditionals, loops, and how to make more complex programs. But before this, I think it is important to make sure we have the previous videos down well. These next few videos will quiz you on some parts of C. If you have a hard time answering these question, you might want to review your notes.


Continue reading “C Programming Tutorial 41 – Quiz Part 1”

C Programming Tutorial 40 – How to use the Type Cast Operator

Did you read the last blog? Go read it on Implicit Type Promotion! Are you new here? Start at the beginning, Intro to C!

Now, let’s give an example of explicit conversion:



In this situation, we are splitting the pieces of pizza with our friend. We are trying to figure out how many pieces each person should get.

Both operands are integers, so the result will be an integer. There are two ways we can fix this. First, we can add .0 to the 2. This works, but it will not always work. For example, we could have this:


Continue reading “C Programming Tutorial 40 – How to use the Type Cast Operator”

C Programming Tutorial 39 – Implicit Type Promotion

The previous blog was foundational to this blog, so go read that first! Are you new here? Start at the beginning, Intro to C!

Essentially, casting is when something of a certain data type is converted to a different data type.

This blog is going to be showing examples of both implicit casting and explicit casting. When you study implicit conversion in C, you will likely come across the term promotion.


Continue reading “C Programming Tutorial 39 – Implicit Type Promotion”

C Programming Tutorial 38 – Type Casting

Did you read the last blog on Strongly Typed Vs Loosely Typed Languages? Are you new here? Start at the beginning, Intro to C!

In the previous video we mentioned how C was a strongly typed language. Imagine C as a grumpy old man who you owe a dollar bill to. Well, he wants his money now, but all you have is some change.

You look at your change, grab four quarters, and find out that it adds up to exactly a dollar. But unfortunately, you owe him a dollar bill, not just 100 cents. So yeah, he beats you over the head with his cane.


Continue reading “C Programming Tutorial 38 – Type Casting”

C Programming Tutorial 37 – Strongly Typed Vs Loosely Typed Languages

Did you read the last blog on Operator Precedence? Are you new here? Start at the beginning, Intro to C!

This blog is going to be an introduction to how programming languages consider data types. As we know, there are many data types in C programming. C is an example of a strongly typed programming language. Strongly typed means that every piece of data has a specific type.

Concatenation

Imagine if we stored everything in strings. This would become a problem because the computer would never know how to work with certain data. For example, let’s say we have “5” and “6” and we try to add them. Should the computer add the numbers to be “11”, or should it combine the strings to be “56” (The process of combining two strings like this is known as concatenation).


Continue reading “C Programming Tutorial 37 – Strongly Typed Vs Loosely Typed Languages”