Level 2 c program design question (1), c program design question
Original article: http://www.cnblogs.com/imaker/p/6120951.html
Year: 2010.9; 2011.3; 2012.3;
Compile the function fun. Its function is to find the value of the maximum element in the 2 x M integer two-dimensional array and return this value to the call function.
Note: Some source programs are in the PROG1.C file.
Do not change the main function or any content in other functions. Just fill in the brackets of function fun with several statements you have written.
The Code is as follows:
1 # define M 4 2 # include <stdio. h> 3 int fun (int a [] [M]) 4 {5 int I, j, max = a [0] [0]; 6 for (I = 0; I <2; I ++) 7 for (j = 0; j <M; j ++) 8 if (max <a [I] [j]) 9 max = a [I] [j]; 10 return max; 11} 12 13 void main () 14 {15 int arr [2] [M] = {5, 8, 3, 45, 76,-4, 12, 82}; 16 printf ("max = % d \ n", fun (arr); 17}
Run the following command:
Thank you for reading this article! Hope it can help you !! Sharing is also a pleasure !!! Please relay...