usuń stertę po zwróceniu wskaźnika

Mam funkcję jak poniżej

int* readFile(string InputPath)
{
    int *myvar = new int[10]; //The file has 10 lines (Using heap)

    ifstream inFile;

    inFile.open(InputPath.c_str(), ios::in);

    if (inFile.fail())
    {
        cout << "Error reading the input file ";
        cout << InputPath << ".";
        exit(0);
    }
    string fileLine;

    while (getline(inFile, fileLine))
    {
       myvar[i]=toint(fileLine); //will be converted to int!
    }
    ;
    inFile.close();



    return myvar;
}:

Jak mogę uwolnić stertę (myvar)? Ogólnie, jaka jest najlepsza metoda zwracania takiej tablicy?

questionAnswers(5)

yourAnswerToTheQuestion