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

Learn typedef in 5 minutes! ๐Ÿ“›

11.5K views on YouTube

#coding #programming #cprogramming

typedef int Number;
typedef char String[50];
typedef char Initials[3];

int main() {

// typedef = reserved keyword that gives an existing datatype a “nickname”
// Helps simplify complex types and improves code readability

// typedef existing_type new_name;

// Example 1

Number x = 3;
Number y = 4;
Number z = x + y;

printf(“%d”, z);

// Example 2

String name = “Bro Code”;
printf(“%s”, name);

// Example 3

Initials user1 = “BC”;
Initials user2 = “SS”;
Initials user3 = “PS”;
Initials user4 = “ST”;

printf(“%s\n”, user1);
printf(“%s\n”, user2);
printf(“%s\n”, user3);
printf(“%s\n”, user4);

return 0;
}