Switch Mode C Programming
//A switch statement allows a variable to be
//tested for equality against a list of values.
#include <stdio.h>
int mode = 2;
int main() {
//switch takes argument and gives cases for it.
switch (mode) {
//each case has a value for which it tests...
case 1:
//Your code goes here...
printf("This is mode #1.\n");
//each case must have break otherwise code will fall
//through into next case. This is good for some things
//like testing multiple case at once on the same value, though.
break;
case 2:
//Your code goes here...
printf("This is mode #2\n");
break;
case 3:
//Your code goes here...
printf("This is mode #3.\n");
break;
}
return 0;
}
Also in C:
- typedef vs #define
- jsdocs returns
- vbnet create and write on file
- 32bit or 64bit
- how to make services in linux
- how to input a string into a char array cpp
- warning: function returns address of local variable [-Wreturn-local-addr]
- c fork wait for child
- c program hide console window
- c how to define a variable
- Switch Mode C Programming
- boolean c
- for statement in c
- factorial of a given number in c
- how to read space separated words in c
- pygame detect click
- !isdigit c
- c \b
- arduino keypad wait for key
- default password raspberry pi
- c copy string
- execute maven project in cmd
- fread
- switch case c