In the following control structure which is faster?
1.Switch
2.If-else
and which consumes more memory?
Answer Posted / abhradeep chatterjee
According to me, switch is faster. cause in nested if-
else, the checking occurs in each step. So, more the
compiler checks, the more it takes time. So switch case is
faster.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Is register a keyword in c?
What is boolean in c?
What is a const pointer in c?
What is the difference between declaring a variable and defining a variable?
What is wrong with this program statement? void = 10;
Is c call by value?
can we have joblib in a proc ?
Does * p ++ increment p or what it points to?
Explain the difference between exit() and _exit() function?
Explain continue keyword in c
What is the difference between struct and typedef struct in c?
What is the difference between int main and void main?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
What is "Duff's Device"?
Does c have an equivalent to pascals with statement?