logo

CuriousTab

CuriousTab

Discussion


Home Interview Technology Comments

  • Question
  • What is the difference between realloc() and free()?


  • Correct Answer
  • The free subroutine frees a block of memory previously allocated by the malloc subroutine Undefined results occur if the Pointer parameter is not a valid pointer If the Pointer parameter is a null value, no action will occur The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines Undefined results occur if the Pointer parameter is not a valid pointer 


  • Technology problems


    Search Results


    • 1. What do you mean by multiple inheritance in C++ ?
    • Discuss
    • 2. What do you mean by early binding?
    • Discuss
    • 3. What do you mean by late binding?
    • Discuss
    • 4. What is namespace?
    • Discuss
    • 5. What is dynamic binding?
    • Discuss
    • 6. What is the difference between class and structure?
    • Discuss
    • 7. What is the output of this program? #include using namespace std; int main() { int arr[] = {4, 5, 6, 7}; int *p = (arr + 1); cout << arr; return 0; }

    • Options
    • A. 4
    • B. 5
    • C. address of arr
    • D. 7
    • Discuss
    • 8. What is the output of this program? #include using namespace std; struct sec { int a; char b; }; int main() { struct sec s ={25,50}; struct sec *ps =(struct sec *)&s; cout << ps->a << ps->b; return 0; }

    • Options
    • A. 252
    • B. 253
    • C. 254
    • D. 262
    • Discuss
    • 9. What is the output of this program? #include using namespace std; void fun(int x, int y) { x = 20; y = 10; } int main() { int x = 10; fun(x, x); cout << x; return 0; }

    • Options
    • A. 10
    • B. 20
    • C. compile time error
    • D. none of these
    • Discuss
    • 10. What is function prototype in C++?
    • Discuss


    Comments

    There are no comments.

Enter a new Comment