int getmin(int a, int b)
{
return a
the memory allocated by malloc gets initialized to zero, so i am checking for that condition.
That's incorrect. From the draft:
Description
2 The malloc function allocates space for an object whose size is specified by size and whose value is indeterminate.
Your getsize needs to be fixed.
My reallocation function is working fine.
You are not even fixing the alignment -- it may fail for certain types. Read this SO question.
Also can we do inplace reallocation if the size of the previously allocated memory is greater than the new required?
What would in-place reallocation mean? Shouldn't this be a simple no-op?