what is the different between if-else and switch statment
(other than syntax)
Answer Posted / bakhtiar khan wazir
IF Statement: Checks the value of data is less than or greater than. (in ranges).
example: can tell wether an input age is more than 18 and less than 60.
Switch Case: Checks the value of data that is prespecified. only equal to.
example: Can only generate output if the value matches. When the age is 18 or when the age is 60 . No comarison of data based on greater than or smaller than. Compares data based on equality.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is variable and explain rules to declare variable in c?
Explain the ternary tree?
Why do some versions of toupper act strangely if given an upper-case letter?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
Hi can anyone tell what is a start up code?
Why is c fast?
What is wrong with this program statement?
What is a macro?
Why do we use & in c?
which is an algorithm for sorting in a growing Lexicographic order
Why structure is used in c?
Is multithreading possible in c?
Explain bitwise shift operators?
.main() { char *p = "hello world!"; p[0] = 'H'; printf("%s",p); }
What is a struct c#?