Home / C Programming / Memory Allocation :: General Questions

C Programming :: Memory Allocation

  1. Which header file should be included to use functions like malloc() and calloc()?

  2. A.
    memory.h
    B.
    stdlib.h
    C.
    string.h
    D.
    dos.h

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What function should be used to free the memory allocated by calloc() ?

  4. A.
    dealloc();
    B.
    malloc(variable_name, 0)
    C.
    free();
    D.
    memalloc(variable_name, 0)

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. How will you free the memory allocated by the following program?

     #include
     #include
     #define MAXROW 3
     #define MAXCOL 4  
     int main()
     {   
         int **p, i, j;  
         p = (int **) malloc(MAXROW * sizeof(int*));   
         return 0; 
    } 
    

     

  6. A.

    memfree(int p);

    B.

    dealloc(p);

    C.

    malloc(p, 0);

    D.

    free(p);

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Specify the 2 library functions to dynamically allocate memory?

  8. A.
    malloc() and memalloc()
    B.
    alloc() and memalloc()
    C.
    malloc() and calloc()
    D.
    memalloc() and faralloc()

    View Answer

    Workspace

    Discuss Discuss in Forum