I'm trying to do something similar to the code snippet below but the program crashes before main exits with
HEAP Invalid address specified to RtlValidateHeap
The idea is to have a function that creates a struct, fills a member array of the struct and returns the struct.
struct Sentence
{
    int char_count;
    char* characters;
    Sentence() {}
    Sentence(int input_char_count) : char_count(input_char_count) {
        characters = new char[char_count];
    }
    ~Sentence()
    {
        delete[] characters;
    }
};
Sentence write_alphabet(int length)
{
    Sentence s(length);
    for (int i = 0; i < length; i++)
        s.characters[i] = 'a' + i;
    return s;
}
int main()
{
    Sentence a_to_m;
    a_to_m = write_alphabet(length);
}
I created characters with new so it should be ok to delete[] right?
