C++ Switch Statement
C++ Switch Statement. In this video, you will learn how to use a switch statement for comparing values instead of using an if/else condition statement. With a switch statement, at compile time, a jump table/look up table is created, which maps each case value. With the table, C++ will jump to the case that matches the value. This is much more performant than an if/else statement, where we need to check each individual if statement until we hit our condition. This is known as the if/else ladder.
In addition, you will learn how to group switch cases together and use the break statement to exit the switch case code blocks.
C++ Playlist:
https://www.youtube.com/playlist?list=PLnKe36F30Y4ZDNIOZ51sX25pWKQ1pkpTE
Subscribe for more coding tutorials 😄!
Other Videos By Kenny Yip Coding
2024-03-25 | C++ Dynamic Arrays (Dynamically Allocated Array) |
2024-03-20 | Dynamic Memory Allocation in C++ |
2024-03-19 | C++ Pointers and Arrays |
2024-03-18 | C++ Null Pointers |
2024-03-14 | References in C++ |
2024-03-13 | C++ Const Pointers vs Pointer To Const |
2024-03-12 | Pointers in C++ |
2024-03-11 | Tic Tac Toe Game in C++ |
2024-03-10 | Multidimensional Arrays in C++ (2D arrays) |
2024-02-29 | Rock Paper Scissors Game in C++ |
2024-02-20 | C++ Switch Statement |
2024-02-19 | C++ Break and Continue Statements |
2024-02-14 | Do While Loops in C++ |
2024-02-12 | While Loops in C++ |
2024-02-08 | For Each Loop in C++ |
2024-01-30 | Code Flappy Bird in Java |
2024-01-29 | For Loops in C++ |
2024-01-18 | Why does index start at 0 in computer science? |
2024-01-17 | C++ Vectors and Dynamic Arrays |
2024-01-16 | C++ String and C Strings |
2024-01-08 | Arrays in C++ |