C Programming Tutorial 47 – How to Write If Statement with Boolean Variables

In the last blog I spoke of how if statements work. In this blog we are going to write a very simple if statement with a bool variable! Remember that we have to have #include <stdbool.h> in our code. Are you new here? Start at the beginning, Intro to C!

This works and all and you can see that it adds a layer of functionality to our program, but this really isn’t that cool. You can see that we are selves are assigning true to the bool variable, so we wouldn’t really even need this conditional. We know it’s going to run, so we could just print what we want to print and delete the conditional.

Continue reading “C Programming Tutorial 47 – How to Write If Statement with Boolean Variables”

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 “