Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

If statements are easy! 🤔

20.7K views on YouTube

#coding #programming #cprogramming

00:00:00 numbers
00:06:10 booleans
00:09:08 check if string is empty

// if statement = Do some code if a condition is true.

// EXAMPLE 2

bool isStudent = true;

if(isStudent){
printf(“You are a student”);
}
else{
printf(“You are NOT a student”);
}

// EXAMPLE 3

char name[50] = “”;

printf(“Enter your name: “);
fgets(name, sizeof(name), stdin);
name[strlen(name) – 1] = ‘\0’;

if(strlen(name) == 0){
printf(“You did not enter your name”);
}
else{
printf(“Hello %s”, name);
}