Level 2 c program design question (1), c program design question

Source: Internet
Author: User

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...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.