Answer Posted / babitha
Library:<stdlib.h>
define:void *realloc(void *ptr, size_t size);
it modifies the existing size of block to new size with
copies of existing data.simply it add/delete the memory of
existed pointer based on new size without changing its
contents and it returns the pointer of first location.
possible cases:
1.if size >0,ptr is not null->modify the ptr with new size
and return pointer of 1st location.
2.if size is 0,ptr is not null->it would not change the
size of pointer but delete the existing contents.
3.if size >0,ptr is null->create new ptr with that size and
return that new pointer.
4.if there is not enough space to rellocate ptr,then it
return null pointer with out changing the block of data.
case 2 and 4 are disadvantages,since orignial contents are
getting deleted and also if we trying to use null pointer
then it would crash the program.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is structure of c program?
write a c program to do the following: a) To find the area of a triangle. b) To convert the temperature from Fahrenheit to Celsius. c) To convert the time in hours : minutes : seconds to seconds.
Hai what is the different types of versions and their differences
Write the program that calculates and prints the average of several integers. Assume that the last value read is sentinel 9999.
What is a void pointer in c?
What is array in c with example?
What is the size of enum in bytes?
What does void main () mean?
Explain enumerated types.
Which is best linux os?
How do you construct an increment statement or decrement statement in C?
How many levels of pointers can you have?
What are the features of the c language?
What is typedf?
write a program to rearrange the array such way that all even elements should come first and next come odd