Why is it that when i try to free my dynamic array it gives me an invalid address specified error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is it that when i try to free my dynamic array it gives me an invalid address specified error?

I am trying to free(array) on a double* array = malloc...; , but i keep on getting this error. can anyone help/explain?

29th Oct 2021, 1:38 AM
Kareem Idris
4 Answers
+ 4
Can you share your code? Save your code in code playground and share it's link here
29th Oct 2021, 2:07 AM
Rishi
Rishi - avatar
+ 2
Either you already freed that memory or you're trying to free and address that was not given to you by a malloc(calloc, realloc)
29th Oct 2021, 5:39 AM
Angelo
Angelo - avatar
+ 1
It was because i wrote my realloc wrong
30th Oct 2021, 2:34 AM
Kareem Idris
- 3
Kimbo Slicer 🤦🤦 At least try to read your own code carefully before asking questions. Unbelievable!
30th Oct 2021, 9:35 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar