on-internet
← Community

Why am I getting this memory access error 'double free or corruption'?

Stack Overflow ·

I am getting the following type of error. I know it has something to do with me improperly accessing memory, but I don't exactly how. Please help me see where I have gone wrong. *note I have simplified my function and it is not obvious what the variables are doing, I just need to know how I am implementing the function incorrectly or where I am misusing memory access. int my_function(char const *file_name, size_t max) { myStruct.pStore = fopen(file_name,"w+"); //pStore is a FILE* myStruct.max = max; // fill the with zeros ('0') int numberOfZeros = max*SIZE; char zeros[numberOfZeros]; int i=0;

Comments

Sign in or sign up to comment and upvote.

No comments yet.