What is the difference between if else and switchstatement
Answer / Surya Pratap Singh
In the programming language C, both if-else statements and switch statements are used for making decisions based on conditions. However, they differ in their syntax and the number of conditions they can handle. An if-else statement is used to test one condition at a time, and it can include multiple nested if-else statements for handling more complex conditional logic. A switch statement allows for testing multiple conditions using a single statement, and it can be more efficient when dealing with many similar cases. Each case in a switch statement corresponds to a specific value or range of values, and the program execution jumps directly to the corresponding code block when the switch expression matches one of the cases.
| Is This Answer Correct ? | 0 Yes | 0 No |
In scanf h is used for
write a program to display the frequency of each element in a given array in c language
What is that continue statement??
The operation of a stair case switch best explains the a) or operation b) and operation c)exclusive nor operation d)exclusive or operation Which of the following is/are syntactically correct? a) for(); b) for(;); c) for(,); d) for(;;);
1 Answers HCL, Public Service Commission,
What is this pointer in c plus plus?
main() { int a[10]; printf("%d",*a+1-*a+3); }
what is use of loop?
Is fortran still used today?
Explain what are linked list?
What are terms in math?
What is the difference between ‘g’ and “g” in C?
How can you read a directory in a C program?