0

I am coding 2 dynamic arrays. basically ive done the first part which requires the user to enter rows and columns, i also implemented the functions to print and fill the created arrays. now the next task is to create a SINGLE dimensional array with enough size to fit the 2d array and load the 2d array there in row major order.

```
#include <stdio.h>
#include <stdlib.h>
void fillit(double **, int , int);
void printit(double **, int, int);
int main()
{
double **m;
int r, c;
int i;
printf("\n How Many Rows? ");
scanf("%d", &r);
printf("\n How many Cols ");
scanf("%d", &c);
m=(double **)malloc(r*sizeof(double *));
for(i=0; i<r; i++)
m[i]=(double *)malloc(c*sizeof(double));
fillit(m, r, c);
printit(m, r, c);
return 0;
}
void printit(double **m, int r, int c)
{
int i, j;
for(i=0; i<r; i++){
for(j=0; j<c; j++){
printf("%.*f,",2, m[i][j]);
}
printf("\n");
}
}
void fillit(double **m, int r, int c)
{
int i, j;
for(i=0; i<r; i++){
for(j=0; j<c; j++){
m[i][j]=(i*100)+j;
}
}
}
```