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
What do you understand by normalization of pointers?
What is a pointer variable in c language?
How can you find the day of the week given the date?
What are called c variables?
What is struct node in c?
How is a null pointer different from a dangling pointer?
Write a program to swap two numbers without using the third variable?
What is LINKED LIST? How can you access the last element in a linked list?
Write a program which returns the first non repetitive character in the string?
Why is c platform dependent?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
What does node * mean?
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
Which one would you prefer - a macro or a function?
What is main return c?