i wrote a code that will asks the user to enter a sentence and store the string in a dynamic array. copy the content of the old dynamic array into the new dynamic array and the while loop keeps going and asks the user to enter something new again and store in a new dynamic array. when i run it i am getting :
Unhandled exception at 0x0FB44B19 (vcruntime140d.dll) in countA.exe: 0xC0000005: Access violation writing location 0x2B5063A5.
i know that i can use vectors but for practice purpose , i am only allowed to use dynamic arrays.
the problem is that size is initially 0. That means you cannot assign a string. So either it starts with unsigned size = 1; or you move line 38 after line 64 (before line 66).
i know that i can use vectors but for practice purpose , i am only allowed to use dynamic arrays.
you could have used dynamic arrays for the day names individually (instead of std:::string) as well as storing all the day names in one dynamic array container which appears to be purpose of this exercise: