I have a top function with an array of pointers like this:
Membership *mf[5];
for(i=0;i<5;i++)
mf[i]=(Membership*) malloc(sizeof(Membership))
where Membership is a structure.
So far so good and when debugging, mf shows all the 5 entities correctly. Problem is when I pass that array of pointers to a function (which can't have anything to do with pointers) like this:
call_function(*mf)
where call_function() is declared like this:
void call_function(Membership mf[5]){
normalize_function(mf[0],slope);
....
normalize_function(mf[5],fuel);
}
In there, mfjust becomes useless and with length 1 instead of 5. I can't understand what I'm doing wrong, even after searching/reading about this and debugging for a while. Please help me on how to change call_function() (not the array of pointers).
Edit: As suggested I did some changes to the code.
Edit2: In response to KyleStrand's answer: call_function()can't have anything to do with pointers because that function is actually going to be implemented in FPGA (VHDL coding) and pointers there are unecessary complications.
void call_function(...,Membership[5]);, i.e., shouldn't it expect an array of typeMembership(sincemfis not a type)?Membership mf[5]) is not directly convertible to "pointer to the first element in a contiguous array of 5 pointers, each of which point to a single Membership" (a.k.aMembership *mf[5]), or vice versa.