C Interviews
C Interview
A NULL macro is simply ?0? (zero) defined in a macros.
Static variable is a variable that has visibility of a local variable and life time of an external variable. It is stored in main memory and has default value zero.
Auto variables are stored in main memory and their default value is a garbage value.
Global , static, local : In main memory Register variable: In registers
Evaluation of any expression is from left to right. Preincrement is faster because it doesn't need to save the current value for next instruction whereas Postincrement needs to saves current value to be incremented after execution of current instruction.
Major differences between arrays and linked lists are: (i) In array consecutive elements are stored in consecutive memory locations whereas in linked list it not so. (ii) In array address of next element is consecutive and whereas in linked list it is specified in the address part of each node. (iii) Linked List makes better use of memory than arrays. (iv) Insertion or deletion of an element in array is difficult than insertion or deletion in linked list.
A malloc( ) function allocates a block of memory of the specified size and returns a pointer of specified data type whereas a calloc( ) function allocates a space for an array of elements , initializes them to zero and then returns a pointer to the memory.
Major advantages of pointers are: (i) It allows management of structures which are allocated memory dynamically. (ii) It allows passing of arrays and strings to functions more efficiently. (iii) It makes possible to pass address of structure instead of entire structure to the functions. (iv) It makes possible to return more than one value from the function.
c stands for counter and v stands for vector.