3. Sort and find (nor, but very important)
4. A number of array of operations (less talking, but also important)
Array example
Example 7. Define the two-dimensional array of N * N and automatically assign values in the main function. Please prepare a function of FUN (), which is: Make the value of the array in the upper half element by M
For example: if m = 2, a, the array is:
a =
Note: Some source programs have been given.
Do not change the contents of the main function main ().
Question procedure:
#include
#include
#include
#define n 5
Void Fun (int A [] [N], INT M)
{
}
Main ()
{
INT A [n] [n], m, j, i;
CLRSCR ();
Printf ("******************************************** / n");
For (i = 0; i { For (j = 0; j { a [i] [j] = rand ()% 20; Printf ("% 4D", A [i] [j]); } Printf ("/ n"); } DO m = rand ()% 10; While (m> = 3); Printf ("M =% 4D / N", M); Fun (a, m); Printf ("******************************************* / n"); For (i = 0; i { For (j = 0; j { Printf ("% 4d", A [i] [j]); } Printf ("/ n"); } } Difficulties in this question: Find those things to change Reference answer: Void Fun (int A [] [N], INT M) { INT I, J; For (i = 0; i { For (j = i; j { A [i] [j] = a [i] [j] * m; } } }