0

I am not sure I am doing what I think I am doing: I want to pass an array to a function in the following way:

void gauss(double**, double**, int)
int main(){
   double **a,**b;

   a=new double*[n];
   b=new double*[n];
   int n;
   ...
   gauss(a,b,n)
   ...
   return 0;}
void gauss(double**a, double**b,int n){...}

My problem is that I can't assign values to my array. I tried

a[0][0]=1;
a[0][1]=2;
a[1][0]=3;
a[1][1]=4;

but I get a segmentation violation error.

How do I assign value to my array in this case.

mattiav27
  • 655
  • 2
  • 9
  • 27

0 Answers0