engineering computer science MCQ #2154

The function `malloc()` is used to

engineering computer science MCQ #2154

  1. Question 1

    Q1. The function `malloc()` is used to

    • A) allocate memory on the stack
    • B) allocate memory on the heap
    • C) free allocated memory
    • D) check if a pointer is NULL

    Answer: allocate memory on the heap

    Explanation: malloc() dynamically allocates memory on the heap. allocate memory on the heap is correct because it matches what the question requires. NET computer science MCQs often test this core concept.