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 |
write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.
write a statement to display all the elements array M(in reverse order? int M[8]={20,21,22,23,24,25,26,27};
How does the C program handle segmentation faults?
how to find binary of number?
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?
wat is output of the following int main() { const int j=2; int i; switch(i) { case 1:break; case j:break; default:break; } }
Do array subscripts always start with zero?
Why is python slower than c?
what is the difference between embedded c and turbo c ?
When is a void pointer used?
5. distance conversion: Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer
How do I use void main?