I'm not entirely experienced with C, but I am trying to write a 2D char array to a file, but am having some issues. Any and all help is greatly appreciated. Please let me know if any additional information/context is needed.
Error
malloc.c:2401: sysmalloc: Assertion `(old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)' failed. Aborted (core dumped)
My Array Declaration
#define MAX_LINE 80
#define HISTORY_SIZE 10
char history[HISTORY_SIZE][MAX_LINE];
My Write Function
void writeHistory(){
char *fname = getHistoryFileName();
FILE *fp = fopen(fname, "wb");
if (!fp){
printf("Unable to write to history file");
exit(1);
}
//Write to the file
fwrite(history, sizeof(history), 1, fp);
fclose(fp);
}