Q
questions?
I tried to pass a two dimensional array in the function arguments
the following program is a demonstration,
********************************************
# include <stdio.h>
# include <string.h>
double data[2][2]={{1.0, 3.0},{9.0, 8.0}};
void print_matrix(double **income,int n,int m){
int i,j;
for(i=0;i<n;i++){
for(j=0;j<m;j++)
printf("%f ",income[j]);
printf("\n");
}
}
int main(void){
print_matrix(data,2,2);
return 0;
}
******************************************
I have segmentation error in running the program
-Wall give me warning about unmatched arguments.
How to pass the two dimensional array without doing
void print_matrix(double income[2][2],2,2);
but with double ** ?
thanks a lot for any suggestions
the following program is a demonstration,
********************************************
# include <stdio.h>
# include <string.h>
double data[2][2]={{1.0, 3.0},{9.0, 8.0}};
void print_matrix(double **income,int n,int m){
int i,j;
for(i=0;i<n;i++){
for(j=0;j<m;j++)
printf("%f ",income[j]);
printf("\n");
}
}
int main(void){
print_matrix(data,2,2);
return 0;
}
******************************************
I have segmentation error in running the program
-Wall give me warning about unmatched arguments.
How to pass the two dimensional array without doing
void print_matrix(double income[2][2],2,2);
but with double ** ?
thanks a lot for any suggestions