C Programming - Memory Allocation - Discussion

Discussion Forum : Memory Allocation - General Questions (Q.No. 4)
4.
Specify the 2 library functions to dynamically allocate memory?
malloc() and memalloc()
alloc() and memalloc()
malloc() and calloc()
memalloc() and faralloc()
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
20 comments Page 1 of 2.

Yuvapriya said:   1 decade ago
malloc() - allocating a block of memory dynamically and sets all the bits to zero.

Eg:

ptr = (cast-type*)malloc(byte_size);


calloc() - allocating multiple block of memory dynamically.

Eg:

ptr=(cast-type*)calloc(n, ele_size);
n-->no of blocks

Soundarya kumari .B said:   1 decade ago
malloc(): Allocates the specified number of bytes
calloc(): Allocates the specified number of bytes and initializes them to zero these are present in the standard library.

Raj said:   1 decade ago
malloc: Memory allocation function ptr.

calloc: Allocate space for an array.

realloc: Memory allocation that modifies the size of previously allocated space.

Riend said:   1 decade ago
malloc will return an uninitialized chunk of memory for you to use.
calloc ( clear alloc ) will attempt to initialize that chunk of memory to all bits zero.

Bhargavi said:   1 decade ago
The malloc() is used to assign the single block of memory at run time and the calloc() is used to assign the multiple blocks of memory at runtime.

Chandrika said:   9 years ago
malloc is used to assign the single block of memory dynamically.

calloc is used to assign the multiple block of memory dynamically at run time.
(1)

C budda reddy said:   1 decade ago
Memory is allocated for the functions and its variables.

Dealloc is delete the after complete operations memory resource is deallocated.

Amit said:   9 years ago
A program is a soft code which makes any processor to perform some function, It provides instructions to the processor.
(1)

Charvi said:   3 years ago
malloc() and calloc() are library functions that dynamically allocate memory.
(1)

Abhishek Rai Sharma said:   1 decade ago
What is the difference between malloc() and calloc()?


Post your comments here:

Your comments will be displayed after verification.