C Languages Interview Questions

5. What is the difference between variable declaration and variable definition in C?
 
  • Variable declaration tells the compiler about data types and size of the variable. Whereas, variable definition allocates memory to the variable.
  • Variable can be declared many times in a program. but definition can happen only one time for a variable in a program.
  • Variable declaration is for assignment of properties and identification to a variable. Whereas, variable definition is for assignments of storage space to a variable.
 
Your Name Your Email-ID
Your Answer
6. What is the difference between auto variables and static variable in C?
 
  • Both auto and static variables are local variables.
  • Static variables can retain the value of the variable between different function calls.
  • But, scope of auto variable is within the function only.
  • It can't retain the value of the variable between different function calls.
 
Your Name Your Email-ID
Your Answer
7. What is the difference between call by value and call by reference?
  When using Call by Value, you are sending the value of a variable as parameter to a function.
Where Call by Reference sends the address of the variable. Also under Call by Value, the value in the parameter is not affected by whatever operation that takes place, while in the case of Call by Reference, values can be affected by the process within the functions.
 
Your Name Your Email-ID
Your Answer
8. What is const pointer in C?
 
  • Const pointer is a pointer that can't exchange the address of the variable that of pointing to.
  • Once const pointer is made to point one variable, we can't change this pointer to point to any other variable.
  • This pointer is called const pointer.
 
Your Name Your Email-ID
Your Answer
123456789101112


131415 Page 2 of 15