Home > Back-end >  Small white C.. Excuse me this question, the size of the input array to yourself and two dimensional
Small white C.. Excuse me this question, the size of the input array to yourself and two dimensional

Time:11-20

Title the following
2. Write a program to obtain the sum of two 2 d arrays (i.e. for, matrices). You will ask the user to input the size of the matrices as well as the matrices. Use Pointers in the program.
Write a two two-dimensional arrays, and the program, for the users to input the array size and number, and used in the program pointer






Below is I wrote, you don't know how to write the
#include

Void sum (int * (a) [c], int * (b) [d], int, c int d, int e, int f)

{
Int c, d, e, f;
Int sum1=0;
Int sum2=0;
For (c=0; CFor (d=0; DSum1 +=* (* (a + c) + k);
}
}
For (d=0; DFor (f=0; fSum2 +=* * (b + c) + (d);
}
}
Printf (" the sum total is in % d ", sum1 + sum2);

}

Int main ()
{
Int j, k, l, m;
Printf (" both please input the size of the array a [] [] in two dimentions: \ n ");
The scanf (" % d % d ", & amp; J., & amp; K);
Printf (" both please input the size of the array b [] [] in two dimentions: \ n ");
The scanf (" % d % d ", & amp; L, & amp; M);
Int I, h;
Int a [j] [k];
Int b [l] [m].
for(i=0; iFor (h=0; HPrintf (" both please input the value in a [% d] [% d] ", I, h);
The scanf (" % d ", a [I] [h]);
}
}
Int o, p;
For (o=0; OFor (p=0; pPrintf (" both please input the value in b [% d] [% d] ", o, p);
}

}

The sum (* a * b, j, k, l, m);
return 0;


}

CodePudding user response:

https://www.cnblogs.com/gmengshuai/p/13976038.html

  • Related