본문 바로가기

Study Meeting/빡공단 30기

[Day 12] Conditional Statement 2: switch - case

In this class, I learned the conditional statement 'Switch' case.

When setting conditions for an specific action, 'Switch' case complete the condition statement by directly specifying each condition.

#include <stdio.h>
#include <stdlib.h>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
    
    switch(value) {
    	case value1:
        	action1;
        break;
        
        case value2:
        	action2;
        break;
        
        case value3:
        	action3;
        break;
    
    return 0;
}