Passing multidimensional arrays to functions
-
Hi, I am having a problem declaring and passing a multidimensional array of floats as an argument to a function. Can someone help me with this problem? My code is enclosed. Any help appreciated.
float\* pData = new float\[nNumRows,2\]; for( int i = 0; i < nNumRows; i++ ) { pData\[i\]\[0\] = ((CSodSpecData\*)pOdbSpecData)->m\_cvData\[i\].Real(); pData\[i\]\[1\] = ((CSodSpecData\*)pOdbSpecData)->m\_cvData\[i\].Imag(); } lErrorCode = pService->serviceNotifyDataEventSet( pData\[0\], strSensorName ); // The function to store the data CDFstatus CABCDEntryPointService::serviceNotifyDataEventSet(float\* dataSet, const CString& varName)
-
Hi, I am having a problem declaring and passing a multidimensional array of floats as an argument to a function. Can someone help me with this problem? My code is enclosed. Any help appreciated.
float\* pData = new float\[nNumRows,2\]; for( int i = 0; i < nNumRows; i++ ) { pData\[i\]\[0\] = ((CSodSpecData\*)pOdbSpecData)->m\_cvData\[i\].Real(); pData\[i\]\[1\] = ((CSodSpecData\*)pOdbSpecData)->m\_cvData\[i\].Imag(); } lErrorCode = pService->serviceNotifyDataEventSet( pData\[0\], strSensorName ); // The function to store the data CDFstatus CABCDEntryPointService::serviceNotifyDataEventSet(float\* dataSet, const CString& varName)
Royce Fickling wrote:
I am having a problem declaring and passing a multidimensional array of floats
Without knowing what that method requires at the address sent as the first parameter all I can offer is this will compile. No way to know if is correct. pService->serviceNotifyDataEventSet( pData, strSensorName ); or pService->serviceNotifyDataEventSet( &pData[0], strSensorName );
-
Hi, I am having a problem declaring and passing a multidimensional array of floats as an argument to a function. Can someone help me with this problem? My code is enclosed. Any help appreciated.
float\* pData = new float\[nNumRows,2\]; for( int i = 0; i < nNumRows; i++ ) { pData\[i\]\[0\] = ((CSodSpecData\*)pOdbSpecData)->m\_cvData\[i\].Real(); pData\[i\]\[1\] = ((CSodSpecData\*)pOdbSpecData)->m\_cvData\[i\].Imag(); } lErrorCode = pService->serviceNotifyDataEventSet( pData\[0\], strSensorName ); // The function to store the data CDFstatus CABCDEntryPointService::serviceNotifyDataEventSet(float\* dataSet, const CString& varName)
Royce Fickling wrote:
float* pData = new float[nNumRows,2];
Should this be:
float pData = new float[nNumRows][2];
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons