When running the following code I get the error:
returning address of local variable or temporary
trying to solve the issue my idea was to change n_date to:
char* n_date = (char*)malloc(sizeof(char) * 60);
However, since I am not allowed to modify the function output_fun, with declaring n_date as a char* I get the error
Compile error c2664 'function' : cannot convert argument n from 'type1' to 'type2'
what could be a solution to this problem?
const char* funA(const char* input)
{
struct tm date;
char n_date[60];
strftime(n_date, 80, "%B %d, %Y", &date);
ouput_fun(n_date);
return (const char*)&n_date;
}