09-09-2007 06:55 PM
09-09-2007 07:26 PM
09-09-2007 11:00 PM
Hey There,
I recompiled your c code and go the same results you got. I see that in the below for loop code, "inputaray", has one r. Was it spelled wrong? I tried to fix it but I"m a bit rusty with pointers. What were you doing in this for loop?
_declspec (dllexport) int ReturnMaxVal(double **inputarray,long rows,long columns,double *max)
{
double **inputaray = new double*[rows];
for (int k = 0; k < rows; k++)
{
inputarray[k] = new double[columns];
}
09-10-2007 05:50 AM
09-10-2007 03:56 PM
09-12-2007 05:10 AM
Hello,
Microsofts VC++ is the worlds most important C- and C++-Compiler.
With C/C++ an array has no attached "really used" dimensions, so you will always have get those values from somewhere. LabVIEW internally of course knows the dimensions of its arrays. But I never wrote a LabVIEW-dll up to know, so I can't really help you on this. 😐
09-12-2007 05:42 AM
09-14-2007 04:03 PM
Hi kaem,
The function should accept dimensions of array "row" and "column" (ie. 8 x 10 ) . It should then be able to accept the dbl array without me having to write func(**array[][10]) for example. Where you see I have specified the number of collumns. For example if I write func(*array) this function will accept any 1xN dimensional array. I do not have to specify the size of the array. However, in two dimensions it seems that C++ does not accept it. So what I would like is a function which accepts a 2-D array without me having to specify the dimensions of the array in the function decleration. Rather, I would like the row and collumn dimensions to be "inputs" into the function and then have code allocate enough memory to handle that array. If you open my code that I attached earlier you may be able to follow along on what I am asking better; if you need more clarification please ask as I would really like to get a handle on this. Thank you very much for your time.
Clint
09-19-2007 06:04 AM
09-19-2007 11:14 AM
Hello,
C and thus C++ can handle higher dimensional arrays en-bloc. 🙂
So a[i] actually also is i[a] because a[i] = *(a+i) = *(i+a) = i[a] as the best C book "A Book on C" explains. 🙂
So we can write these things more compact, but that doesn't really help you with your problem.