double *ptr = malloc(sizeof(double *) * TIME);
/* ... */
for(tcount = 0; tcount <= TIME; tcount++)
^^
- You’re overstepping the array. Either change
<=
to <
or alloc SIZE + 1
elements - Your
malloc
is wrong, you’ll want sizeof(double)
instead of sizeof(double *)
- As
ouah
comments, although not directly linked to your corruption problem, you’re using *(ptr+tcount)
without initializing it
- Just as a style note, you might want to use
ptr[tcount]
instead of *(ptr + tcount)
- You don’t really need to
malloc
+ free
since you already know SIZE