Switch in C Language - tccicomputercoaching.com

Page 1

Switch in C Language tccicomputercoaching.com What is Switch? Switch is used to select any one from multiple choice. The switch statement allows us to execute one code block among many alternatives.

A switch statement tests the value of a choice variable and compares it with multiple cases. Once the case match is found, a block of statements associated with that particular case is executed. Each case in a block of a switch has a different name/number which is referred to as an identifier. Syntax: switch(variable) { case lable1: statement: break; case lable2: statement:


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Switch in C Language - tccicomputercoaching.com by Rosario Riley - Issuu