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 |
Write a program in C to reverse a number by recursive function?
Where in memory are my variables stored?
how to build a exercise findig min number of e heap with list imlemented?
define function
Explain about block scope in c?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
Does free set pointer to null?
what is the output for the code : main() { int i,j; printf("%d %d ",scanf("%d%d",&i,&j)); }
Is the below things valid & where it will be stored in memory layout ? static const volatile int i; register struct { } ; static register;
a construct the"else" part of "if" statement contains anoth "if else" statement is called a) if-else b) else-if-else c) if-else-if-else d) chain if/if-else-if
Print all the palindrome numbers.If a number is not palindrome make it one by attaching the reverse to it. eg:123 output:123321 (or) 12321
How the processor registers can be used in C ?