notes/education/software development/ECE1400/2024-09-11.md

27 lines
746 B
Markdown
Raw Normal View History

2024-09-11 20:35:48 +00:00
Chapter 4 exercises assigned, due monday
# Operators
2024-09-11 20:40:50 +00:00
C emphasizes *expressions* rather than statements.
Expressions are built from variables, constants, and operators.
C provides 5 binary arithmetic operator (arithmetic meaning it requires two things to operate on):
- Addition
- Subtraction
- Multiplication
- Division
- Modulus
Unary operators only require *one* thing to operate on.
2024-09-11 20:45:49 +00:00
- Positive and minus signs
2024-09-11 21:15:49 +00:00
Positive and negative signs have a higher precedence then binary arithmetic operations, and binary arithmetic operations follow the normal order of operations.
## Assignment Operators
- Simple assignment: `=` stores a value into a variable after evaluating an expression
```c
int v;
int e = 5;
// Simple assignment
v = e;
```