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

Functions in C are easy! 📞

35.2K views on YouTube

#coding #programming #cprogramming

void happyBirthday(char name[], int age){
printf(“\nHappy birthday to you!”);
printf(“\nHappy birthday to you!”);
printf(“\nHappy birthday dear %s!”, name);
printf(“\nHappy birthday to you!”);
printf(“\nYou are %d years old!\n”, age);
}

int main() {

// function = A reusable section of code that can be invoked “called”
// Arguments can be sent to a function so that it can use them

char name[50] = “”;
int age = 0;

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

printf(“Enter your age: “);
scanf(“%d”, &age);

happyBirthday(name, age);

return 0;
}