This repository has been archived on 2023-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
VSMechatronics/Exercises/C8/switch_example_3.c

23 lines
466 B
C

#include <stdio.h>
#include <stdlib.h>
int main(void)
{
// Declare some variables
int a = 1;
switch ( a )
{
case 1 :
printf ("This is case 1\n");
case 2 :
printf ("This is case 2\n");
case 3 :
printf ("This is case 3\n");
break ; // end of the lines of code to execute
default: // If no case is met
printf ("This default case\n");
// Code to do if no case is met
}
return 0;
}