In the following control structure which is faster?
1.Switch
2.If-else
and which consumes more memory?

Answer Posted / deepak upadhyay

switch statement is more faster and consumes less memory
than if-else statement the reason being that the switch
statement is applied when we have a single variable to
check but in case of if-else different variable may be
checked at the same time.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is there any demerits of using pointer?

619


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2402


What are the types of macro formats?

598


Why enum is used in c?

515


Write a progarm to find the length of string using switch case?

1601






What does emoji p mean?

593


What is a macro in c preprocessor?

620


How can I delete a file?

624


What are the functions to open and close file in c language?

723


How can I avoid the abort, retry, fail messages?

651


Are pointers really faster than arrays?

554


int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer

645


what is the structure pointer?

1640


What are the functions to open and close the file in c language?

589


Write a factorial program using C.

637