Which of the following functions can be used to allocate space for array in memory?

Options
- calloc()
- malloc()
- realloc()
- both a and b


CORRECT ANSWER : calloc()

Discussion Board
C++ - Memory Allocation

Calloc allocates space for an array elements, initializes to zero and then returns a pointer to memory.

Prajakta Pandit 01-25-2017 02:28 AM

program

i want more programs no theory quiz

sathyapriya 08-19-2015 02:44 AM

answer is wrong

I agree with qwerty. However, for initial allocation of memory, only malloc() and calloc() can be used.

progManTic 02-17-2015 05:44 PM

Explanation

malloc() - Allocates requested size of bytes and returns a pointer first byte of allocated space

calloc() - Allocates space for an array elements, initializes to zero and then returns a pointer to memory

realloc() - Change the size of previously allocated space

career 08-13-2014 12:37 AM

calloc, malloc, realloc

you are mistaken: all three of those functions can be used for allocating space for array in memory

qwerty 08-12-2014 05:29 AM

Write your comments


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)


Advertisement