C Programming - Memory Allocation - Discussion
Discussion Forum : Memory Allocation - General Questions (Q.No. 4)
4.
Specify the 2 library functions to dynamically allocate memory?
Discussion:
21 comments Page 2 of 3.
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.
calloc: Allocate space for an array.
realloc: Memory allocation that modifies the size of previously allocated space.
Abhishek Rai Sharma said:
2 decades ago
What is the difference between malloc() and calloc()?
Asmita said:
1 decade ago
What is alloc() , memalloc() and faralloc() ?
Suvathi said:
1 decade ago
What is a malloc, memalloc and alloc ?
Thangaraj said:
1 decade ago
What is mean by memalloc() and faralloc()?
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
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
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.
calloc ( clear alloc ) will attempt to initialize that chunk of memory to all bits zero.
Mimi said:
1 decade ago
What is the differences between malloc and calloc?
Vishak said:
2 decades ago
calloc expansion?
Tulasi said:
2 decades ago
wat is ment by faralloc where it is used?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers