C Language INTERVIEW QUESTION & ANSWERS
106. |
What is the difference between for and do while loops? |
|
This difference is the place where the condition is tested. The for tests the condition before executing any of the statements within the body of the for loop. As against this, the do while tests the condition after having executed the statements within the loop. |
107. |
What are the types of control structures? |
|
Sequence control structure : may consist of a single statement or a sequence of statements with a single entry and single exit. Selection control structure : performs one out of two or more statements depending upon the condition. Looping control structure : has one condition and a sequence structure which is executed a number of times depending upon the condition.
|
108. |
What is the difference between malloc and calloc? |
|
Malloc is use for memory allocation and initialize garbage values.malloc () for allocating the single block of memory. Calloc is same as malloc but it initialize 0 value.calloc () for allocating multiple blocks of memory. |
109. |
What are the types of constants in c? |
|
C has four basic types of constants. They are : - Integer constants
- Floating point constants
- Character constants
- String constants
|
110. |
What is the difference between call by value and call by reference? |
|
The value of each of the actual parameters in the calling function is copied into corresponding formal arguments of the called function. So, variables in the caller function (actual parameters) are distinct from variables in the called function (formal parameters) even though they may have same names and their values are not affected in the called function, since they have different memory locations. |