I am trying to write a function that receives a varying number of double ** as args. when I try to acces the double ** I get an unhandled exception access violation. Can someone tell me whats up.
//num is the number of arguements being passed. arguements will be double**
void allocate_matrix(int num, ...)
{
va_list ap;
int Inc=0;
extern int nrow,ncol;
va_start(ap,num);
do
{
va_arg(ap, double **) = get_matrix_space(nrow,ncol);
}while(++Inc<num);
va_end(ap);
}
extern double **get_matrix_space(int r, int c)
{
int i;
double **a;
a = calloc(r, sizeof(double *));
--a;
for(i = 1; i<= r; ++i)
{
a= calloc(c,sizeof(double));
--a;
}
return a;
}
//num is the number of arguements being passed. arguements will be double**
void allocate_matrix(int num, ...)
{
va_list ap;
int Inc=0;
extern int nrow,ncol;
va_start(ap,num);
do
{
va_arg(ap, double **) = get_matrix_space(nrow,ncol);
}while(++Inc<num);
va_end(ap);
}
extern double **get_matrix_space(int r, int c)
{
int i;
double **a;
a = calloc(r, sizeof(double *));
--a;
for(i = 1; i<= r; ++i)
{
a= calloc(c,sizeof(double));
--a;
}
return a;
}