disadvantages of realloc ?
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 |
Tell us the use of fflush() function in c language?
plz answer.... write a program that reads line (using getline) e.g."345", converts each line to an integer using "atoi" and computes the average of all the numbers read. also compute the standard deviation.
Explain in detail how strset (string handling function works )pls explain it with an example.
What is a const pointer?
pick out the odd one out of the following a.malloc() b.calloc() c.free() d.realloc()
What is Dynamic memory allocation in C? Name the dynamic allocation functions.
write a program in reverse the string without using pointer,array,global variable declaration,lib fun only using a function?
Write a Program to find whether the given number or string is palindrome.
What does the error message "DGROUP exceeds 64K" mean?
what is structuer?
what is the difference between c and c++?
Explain what are the different data types in c?