LANGUAGES | C | C LANGUAGE INTERVIEW QUESTION AND ANSWERS | 18

Language C Interview

C Language Interview Question and Answers:

86. 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.

87.     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.

88. 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.

89. Can a Structure contain a Pointer to itself?
      Yes such structures are called self-referential structures.

90. 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.

No comments:

Post a Comment