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 |
can we access one file to one directory?
What is a pointer in c plus plus?
What is the Difference between Class and Struct?
What is the correct code to have following output in c using nested for loop?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
Why we write conio h in c?
#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??
what are far pointers?
Why clrscr is used after variable declaration?
What does return 1 means in c?
int j =15,i; for (i=1; 1<5; ++i) {printf ("%d%d ",j,i); j = j-3; }
How many keywords (reserve words) are in c?