I have a doubt related to freeing up the memory in C program. I don't know how memory gets freed up. below are two scenarios where I am not sure whether I do need to free up memory or not.
below is code snippet
int status=0;
char *grade="high";
status=getPreviousReports(grade, year);
free(grade);
my doubt is that getPreviousReports is doing a soap call and passing grade to it. After that it destroys the soap object in memory, that uses grade in forming soap object.
if I use below code then do I need not to free up grade explicitly ?
status= getPreviousReports("high", year);
Please help me in understanding how and when it is required to free up memory.
Thanks in advance.