Join Dan Gookin for an in-depth discussion in this video Making multiple decisions with switch-case, part of Learning C.
- The C Language let's you handle complex decisions…by stacking a bunch of if/else conditions.…Sometimes that structure can get a bit unwieldy.…As an alternative, you can employ the switch case structure…which is yet another decision making tool in the C Language.…In this movie, I introduce the switch case structure.…You'll see how it's constructed,…how it can handle multiple decisions,…plus I'll demonstrate a few tricks.…The bulk of this code is a switch case structure.…
It starts with a switch at line 10, this is followed…by a series of "case" statements,…each of which has its own statements.…The final piece, is default, it's followed…by its own statement as well…and then a closing curly bracket.…These are the elements of the switch case structure.…The switch case structure also makes use…of the "break" keyword.…So all told, this structure contains…four C Language keywords: switch, case, default, and break.…
Build and run the code to see what it does.…I'll type 1, "excellent choice."…Run it a few times to try out various options.…
- Understanding a C program
- Adding comments
- Using escape characters
- Working with values and placeholders
- Introducing variables
- Making a decision with if
- Adding functions
- Manipulating strings
- Building arrays
- Nesting structures
Skill Level Beginner
1. Getting Started
2. Programming Basics
3. Program Flow Control
4. Intermediate C Language Concepts
5. Advanced C Language Concepts
Next steps2m 11s
- 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.