C Language Interview Question and Answers

86. Can a Structure contain a Pointer to itself?
  Yes such structures are called self-referential structures.
 
Your Name Your Email-ID
Your Answer
87. What is the difference between array and pointer?
 
    Array
  • Array allocates space automatically.
  • It cannot be resized
  • It cannot be reassigned.
  • size of (arrayname) gives the number of bytes occupied by the array.

  • Pointer
  • Explicitly assigned to point to an allocated space.
  • It can be sized using realloc() 3-pointer can be reassigned.
  • sizeof (p) returns the number of bytes used to store the pointer variable p.
 
Your Name Your Email-ID
Your Answer
88. What is the difference between syntax vs logical error?
 
    Syntax Error
  • These involves validation of syntax of language.
  • compiler prints diagnostic message.

  • Logical Error
  • logical error are caused by an incorrect algorithm or by a statement mistyped in such a way that it doesn’t violet syntax of language.
  • difficult to find.
 
Your Name Your Email-ID
Your Answer
89. What is preincrement and post increment?
  ++n (pre increment) increments n before its value is used in an assignment operation or any expression containing it. n++ (post increment) does increment after the value of n is used.
 
Your Name Your Email-ID
Your Answer
90. What are the two forms of #include directive?
  #include“filename”
#include - the first form is used to search the directory that contains the source file.If the search fails in the home directory it searches the implementation defined locations.In the second form ,the preprocessor searches the file only in the implementation defined locations.
 
Your Name Your Email-ID
Your Answer