what are the various memory handling mechanisms in C ?
Answers were Sorted based on User's Feedback
Answer / santhi
thre are 3 memory handling mechanisms.they are
malloc,calloc,ralloc.
malloc:which allocates memory to a variable dynamically.
calloc:which allocates blocks of memory.
ralloc: which can be used to reallocation of memory incase
of unsufficient memory which is allocated earlier.
using "delete" we can free the memory allocated to a
variable.
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / henry
malloc(), calloc(), ralloc() are all for allocating memory.
free() is for freeing memory.
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / priya
The malloc function allows the programmer to create a block of memory of a given size:
malloc ( long integer lBlockSize ) returns void *
If we decide, during the execution of the program, that we might need to expand, or contract this memory block, we can use the realloc function:
realloc ( void * pBlock, long int lNewBlockSize ) returns void *
When the memory block is no longer used, then it must be returned back to the operating system, by calling the free function:
free ( void * pBlock )
Is This Answer Correct ? | 2 Yes | 0 No |
Answer / venkatesh kr
In C Language we can use the malloc, calloc & ralloc for memory handling but if we use the above function we should free the memory when the memory is not required.It can be done by "free" function. And also one important point is, suppose if we allocate a memory for an structure and in the process time if the structure is not required the it should be removed by using the "free" function because the system or process will be get crashed on some situations.
Is This Answer Correct ? | 2 Yes | 0 No |
What should be keep precautions while using the recursion method?
Write a program to generate random numbers in c?
What does the format %10.2 mean when included in a printf statement?
Write a program for the following series? 1 121 12321 1234321 123454321 12345654321 1234567654321 123456787654321 12345678987654321 1234567890987654321 123456789010987654321 12345678901210987654321 1234567890123210987654321 .........1234321............ ..........123454321............ ..........12345654321............ 7 8 9 0 1 Pls............?
Can a local variable be volatile in c?
What is the purpose of the code, and is there any problem with it? unsigned int f( unsigned n ) { return –n & 7; }
void main() { static int i = 5; if(--i) { main(); printf("%d ",i); } } what would be output of the above program and justify your answer? }
5 Answers C DAC, CDAC, Infosys, Wipro,
Can anyone help me with this please? Need to print the below values.. Thanks 1 1 2 1 2 3 1 2 3 4
how can I convert a string to a number?
If I have a char * variable pointing to the name of a function ..
what is the basis for selection of arrays or pointers as data structure in a program
what is an array