C: switch case with logical operator
Posted
by
Er Avinash Singh
on Stack Overflow
See other posts from Stack Overflow
or by Er Avinash Singh
Published on 2012-11-05T04:54:11Z
Indexed on
2012/11/05
4:59 UTC
Read the original article
Hit count: 238
c
|switch-statement
While I am new to c and want help in this program
my code is :
#include<stdio.h>
#include<conio.h>
void main(){
int suite=2;
switch(suite) {
case 1||2:
printf("hi");
case 3:
printf("byee");
default:
printf("hello");
}
printf("I thought somebody");
getche();
}
I am working in turbo c and it shows no error and the output is
helloI thought somebody
Please, let me know how is this working ??? note :- here break is not the case as I intentionally left them.
© Stack Overflow or respective owner