# Lecture 3: C basics pt. 2

Today, we continue learning some basic C programming concepts.

### Functions

video

Key ideas:

• Use functions to organize your program and to reuse code
• Input (one or multiple) and output (only one) of functions

### Relational, equality, and logical operators

video

Key ideas:

• relational (>, <, >=, <=) and equality operators (==, !=, !)
• logical operators (&&, ||)
• writing conditions in C: to write that x is in the range -9 to 99, we need to say
x > 10 && x < 100


not -10 < x < 100.

• operator precedence: https://devdocs.io/c/language/operator_precedence

### if statements

video

Key ideas:

• Single alternative or multiple alternative
• Nested if statements

### switch statements

video

Key ideas:

• Alternative to if statements to select one of many alternatives
• Only works with char and int data types for controlling expression
• Must include break statement for each alternative