what are the various memory handling mechanisms in C ?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between call by value and call by reference in c?

621


Why doesnt the call scanf work?

676


What is the return type of sizeof?

596


What is the value of a[3] if integer a[] = {5,4,3,2,1}?

674


What are valid signatures for the Main function?

702






while loop contains parts a) initialisation, evalution of an expression,increment /decrement b) initialisation, increment/decrement c) condition evalution d) none of the above

742


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

583


What is define directive?

643


What is difference between scanf and gets?

615


What is static and volatile in c?

781


What are different types of variables in c?

571


Can you mix old-style and new-style function syntax?

664


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3249


What does nil mean in c?

673


This is a variation of the call_me function in the previous question:call_me (myvar)int *myvar;{ *myvar += 5; }The correct way to call this function from main() will be a) call_me(myvar) b) call_me(*myvar) c) call_me(&myvar) d) expanded memory

734