Expressions are evaluated in a specific sequence called the order of precedence or the order of evaluation. Most calculations work left-to-right with multiplication and division taking place before addition and subtraction and expressions in parentheses are evaluated first. If you want to get the correct answer, you must get the order of operations right.
- You've seen these puzzles on social media. … What's the result of this equation? … People have different answers … and quarrels erupt over who is accurate. … One answer is definitely correct. … And you'll know it, … When you understand the order of precedence. … Here's the order for mathematical operations … in the C language. … Work the equation left to right. … If the equation contains any expression in parentheses, … calculate it first outside of parentheses … before multiplication and division moving left to right, … then perform addition and subtraction moving left to right. … Not only do these rules help you dominate social media, … they help you construct proper expressions … in your C code as well. … This code contains the infamous internet puzzle … shown earlier, … build and run to see who's right, … and who's wrong. … Okay, mystery solved. … So working left to right six divided by two is three, … multiplied by the result of one plus two which is three. … So you get three times three, …
- Writing your first C program
- Working the C development cycle
- Adding comments to code for clarity
- C language data types
- Declaring variables
- Making new data types
- Typecasting variables
- Using math, assignment, and logical operators
- Creating for and while loops
- Nesting loops
- Creating functions
- Returning values from functions
- Passing arguments to functions
- Creating recursive functions
Skill Level Intermediate
C: Data Structures, Pointers, and File Systemswith Dan Gookin2h 57m Intermediate
1. The Fundamentals of C
2. Variables and Values
3. Operators and Math
4. Decisions and Loops
Next steps1m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.