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

Which is best linux os?

572


Tell us two differences between new () and malloc ()?

617


What is the use of header files?

612


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

1423


4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.

1731






What is data type long in c?

630


What are the types of functions in c?

579


is it possible to create your own header files?

648


List the difference between a "copy constructor" and a "assignment operator"?

587


Which header file is essential for using strcmp function?

947


Is that possible to add pointers to each other?

907


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

710


How do you write a program which produces its own source code as output?

616


What are keywords in c with examples?

615


What is a ternary operator in c?

661