Dear,
Is there a way to get the allocated size of the val in the code below?
Actual problem is that I have a double pointer in code and its addressed
is passed to a routine which does some allocation for this pointer to
pointer if I am right in the description. I tried to reproduce a very
simple code for this. Is that possible to get the allocated size in bytes
in main or it should be done in the function itself, but in main I should
be able to perform some operations on this vector? This is actually a C
code I am trying to interface in C++.
#include<iostream>
using namespace std;
void alloc(double **ptr)
{
int i;
*ptr = new double[10];
for(i=0;i<10;++i)
(*ptr)[i]=i*0.36;
}
int main()
{
double* val;
alloc(&val);
// how to get the allocated size or is that
// possible to retrieve some elements for the
// above allocation ?
return 0;
}