C Language Interview Question and Answers

76. What is generic pointer in C?
  In C void* acts as a generic pointer. When other pointer types are assigned to generic pointer,conversions are applied automatically (implicit conversion).
 
Your Name Your Email-ID
Your Answer
77. How pointer variables are initialized?
 
    Pointer variables are initialized by one of the following ways.
  • Static memory allocation
  • Dynamic memory allocation
 
Your Name Your Email-ID
Your Answer
78. What are the advantages of auto variables?
 
  • The same auto variable name can be used in different blocks.
  • There is no side effect by changing the values in the blocks.
  • The memory is economically used.
  • Auto variables have inlierent protection because of local scope.
 
Your Name Your Email-ID
Your Answer
79. What is dynamic memory allocation?
  A dynamic memory allocation uses functions such as malloc() or calloc() to get memory dynamically. If these functions are used to get memory dynamically and the values returned by these function are assigned to pointer variables, such a way of allocating memory at run time is known as dynamic memory allocation.
 
Your Name Your Email-ID
Your Answer
80. What is the purpose of realloc?
  It increases or decreases the size of dynamically allocated array. The function realloc (ptr,n) uses two arguments. The first argument ptr is a pointer to a block of memory for which the size is to be altered. The second argument specifies the new size. The size may be increased or decreased. If sufficient space is not available to the old region the function may create a new region.
 
Your Name Your Email-ID
Your Answer