Should we allocate new memory in the function and return the pointer to this chunk of memory?


  • 0
    D

    In this question, it seems that unless we allocate new memory chunk, or we need a much complicated answer. But In C++ practice, I don't think it is a good idea to allocate new memory in a function and then return its pointer to the main program
    So, what do you think, guys?


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.