I have a small question about using the realloc function. Assuming I have:
typedef struct
{
char* location;
int temp;
int numberOfRec;
}TEMP;
Then I declare a pointer to this struct in the main and allocate the memory:
int main()
{
TEMP* data = xCalloc (1, sizeof(TEMP)); //wrapper function
data->location = xCalloc (20, sizeof(char)); //wrapper function
}
Now if I reallocate the memory for data->location in another function. Do I need to return the address of TEMP* data?
int main()
{
someFunction(data); // Use this function or...
//data = someFunction(data);
...
}
void someFunction(TEMP* data)
{
...
data->location = xRealloc (data->location, 10 * sizeof(char));
}