In the following control structure which is faster?
1.Switch
2.If-else
and which consumes more memory?
Answer Posted / vignesh1988i
as for as me is concerned switch is faster....
in if-else first it will check the if condition , if it is
true it's no problem.. but if it falls false, it will go
to the else part ...
but in switch case , the argument given inside switch
statement will see and automatically to the necessary case
of it... so by comaring the time constraint ,switch saves
the time for checking each else statement for every if....
thank u
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25
How was c created?
Where are local variables stored in c?
How can a string be converted to a number?
Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database.
What is the difference between far and near ?
The purpose of this exercise is to benchmark file writing and reading speed. This exercise is divided into two parts. a). Write a file character by character such that the total file size becomes approximately >10K. After writing close the file handler, open a new stream and read the file character by character. Record both times. Execute this exercise at least 4 times b). Create a buffer capable of storing 100 characters. Now after generating the characters, first store them in the buffer. Once the buffer is filled up, store all the elements in the file. Repeat the process until the total file size becomes approximately >10K.While reading read a while line, store it in buffer and once buffer gets filled up, display the whole buffer. Repeat the exercise at least 4 times with different size of buffer (50, 100, 150 …). Records the times. c). Do an analysis of the differences in times and submit it in class.
Are pointers integers in c?
What is table lookup in c?
Explain union.
the question is that what you have been doing all these periods (one year gap)
What do you mean by keywords in c?
The __________ attribute is used to announce variables based on definitions of columns in a table?
What are identifiers c?
What is a good way to implement complex numbers in c?