what is the different between if-else and switch statment
(other than syntax)

Answer Posted / fazlur rahaman naik

The main difference between switch - case and if - else is
we can't compare variables.

in the if - else, first the condition is verified,then it
comes to else whereas in the switch - case first it checks
the cases and then it switches to that particular case.

Is This Answer Correct ?    168 Yes 35 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need volatile in c?

973


how can use subset in c program and give more example

1715


What is c variable?

833


What are local variables c?

797


please explain clearly about execution of c program in detail,in which stage are the printf sacnf getting into exeecutable code

1958


What does calloc stand for?

883


What is bin sh c?

811


Explain how do you sort filenames in a directory?

831


Is python a c language?

808


Can we change the value of constant variable in c?

846


FORMATTED INPUT/OUTPUT functions are a) scanf() and printf() b) gets() and puts() c) getchar() and putchar() d) all the above

908


What is binary tree in c?

879


Which built-in library function can be used to match a patter from the string?

1040


Why are some ANSI/ISO Standard library routines showing up as undefined, even though I've got an ANSI compiler?

914


A global variable when referred to in another file is declared as this a) local variable b) external variable c) constant d) pointers

906