I wonder if anyone can figure this out ...
My program crashes into this call:
void subtract(data* array,data* inverse,int a, int b, int q, int n) { data* arraytomultiply; arraytomultiply = (data *)malloc(sizeof(data*) * n);
If the data just contains int (this is for convenience when switching types later)
typedef struct { int value; }data;
I tried a lot of messing around with changing pointers here, as I'm not sure about them at all, but to no avail.
The strange thing is, the same call works much earlier in the program, I assign values ββto it and I can print them and that's it ..:
data* array; array = (data*)malloc(sizeof(data*) * m * n);
One thing that can be useful (although I donβt know why) is that when it works earlier, it is used during the void function, whereas when it fails in a function called inside the algorithm. but I donβt see how this can affect him at all, given what I'm trying to do, itβs not using any arguments, etc.
Any ideas?
source share