C Language Interview Question and Answers

56. What is the difference between malloc and calloc?
  malloc is use for memory allocation and initialize garbage values.malloc () for allocating the single block of memory.
where as calloc is same as malloc but it initialize 0 value.calloc () for allocating multiple blocks of memory.
 
Your Name Your Email-ID
Your Answer
57. What is null pointer?
  NULL pointer is a pointer which is pointing to nothing.
Examples :
int *ptr=(char *)0;
float *ptr=(float *)0;
 
Your Name Your Email-ID
Your Answer
58. How are pointer variables initialized?
 
    Pointer variable are initialized in two ways :
  • Static memory allocation
  • Dynamic memory allocation
 
Your Name Your Email-ID
Your Answer
59. What is copy constructor?
  Copy constructor is a constructor function with the same name as the class and used to make deep copy of objects.
 
Your Name Your Email-ID
Your Answer
60. What is the difference between #include‹ › and #include “ ”?
  #include‹ › ----> Specifically used for built in header files.
#include “ ” ----> Specifically used for used for user defined/created n header file.
 
Your Name Your Email-ID
Your Answer