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

C Language Interview Question and Answers - C Language Interview

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.

57.     What is null pointer?
      NULL pointer is a pointer which is pointing to nothing.
Examples :
int *ptr=(char *)0;
float *ptr=(float *)0;

58.     How are pointer variables initialized?   
    Pointer variable are initialized in two ways :
    Static memory allocation
    Dynamic memory allocation

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.

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.

No comments:

Post a Comment