I want to do something like that:
I am calling a function :
myfunc( ....., float ** const ouPointer)
{
....
float * myPointer;
size_t *AnArray;
...
if ( NULL == *ouPointer )
{
myPointer = (float *) malloc( N * sizeof( float ) );
assert( NULL != myPointer );
*ouPointer = myPointer;
}
else
{
myPointer = *ouPointer;
}
for ( int i = 0; i < N; i++ )
{
(&myPointer)[ i ] = (float *) malloc( AnArray[ i ] * sizeof( float ) );
assert( NULL != (&myPointer)[ i ] );
}
//filling pointer
} //end of myfunc
But it gives me seg fault in assert line.
In order to pass the data to rh function I am using:
float * thePointer = NULL;
myfunc(...., &thePointer);