How can i fix this l? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
7th Apr 2020, 2:09 PM
Icebreaker
Icebreaker - avatar
2 Respostas
+ 1
rand() returns a random number that is higher than the number of elements in class_averageChecker(). Lead to error.
7th Apr 2020, 2:23 PM
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ
ä½ ēŸ„é“č¦å‰‡ļ¼Œęˆ‘也ę˜Æ - avatar
0
Additional to what CarrieForle said, you also attempt to free memory that you didn't allocate yourself in averageChecker(). Statically allocated memory is managed automatically and doesn't belong to you. You only need to delete memory you obtained earlier through a call to an allocator, e.g. new() or malloc(), so you should also cut the delete expressions.
7th Apr 2020, 4:18 PM
Shadow
Shadow - avatar