my code line is like below
_set_ptr(TABLEID, i, calloc(qty, sizeof(double)));
where TABLEID
and i
and qty
are int
type and _set_ptr
is a void type function which return NULL.
this is function's declaration
void _set_ptr(int TABLEID, int index, char* ptr)
When I compile it by use of arm g++ tool chain it give me error as below
error: initializing argument 3 of 'void _set_ptr(int, int, char*)' [-fpermissive]
As per malloc
I use new
which equivalent to it, as below
_set_ptr(TABLEID, i, new double[qty]);
but also it give error as below
error: cannot convert 'double*' to 'char*' for argument '3' to 'void _set_ptr(int, int, char*)'
So, Is there any equivalent to calloc
in c++
?
How can I replace it ? And how this new line's syntax will become?
Thanks
Aucun commentaire:
Enregistrer un commentaire