what does \n and %d mean?
Here, in C programming \n is an escape character that helps to create a new line whereas %d is a format specifier that allows to specify only Integer values.
What are the differences between switch case and If
statement.
IF STATEMENTS | SWITCH CASE |
---|---|
If statement is used to select among two alternatives of 'True' i.e. condition is fulfilled and 'False' i.e. condition is not fulfilled. | The switch statement is used to select among multiple alternatives. |
It is a decision making control statement. | It is a selection statement. |
The if statement in C, makes sections based on a single true or false condition. | Switch case offers multiple choice for selection of the statements or we can switch case. |
It is a linear system. | It is a multiway branch system. |
If implements Linear search. | Switch implements Binary search. |
Float, double, char, int and other data types can be used in if condition. | Only int and char data types can be used in switch block. |