- What is the difference between & and * operators in C.
- What will happen if break statement is not used in switch case in C.
- Why is default statement used in switch case in C.
- What is the use of goto statement in C.
What is the difference between “&” and “*” operators in C
The & is a unary operator in C which returns the memory address of the passed operand. This is also known as address of operator.
<> The * is a unary operator which returns the value of object pointed by a pointer variable. It is known as value of operator. It is also used for declaring pointer variable.
What will happen if break statement is not used in switch case in C
The break statement is optional.The break statement at the end of each case cause switch statement to exit. If break statement is not used, all statements below that case statement are also executed until it found a break statement.
Why is default statement used in switch case in C
The default code block gets executed when none of the case matches with expression. default case is optional and doesn't require a break statement.
What is the use of goto statement in C
The goto statement is used to change the default sequence of execution of statements in C program. A goto statement transfers the control to some other part of the program where label is defined. Here is the syntax of goto statement.
label: ......... ......... goto label;When control reaches goto statement, it directly jumps to the line where label is defined without checking any condition. The goto statement can transfer the control to anywhere within the current function.