当前位置:网站首页>【指针】求二维数组中最大元素的值
【指针】求二维数组中最大元素的值
2022-07-06 09:24:00 【|光|】
要求
编一个函数编写程序求二维数组中最大元素的值。(用指针实现)
代码
int find_max(int a[4][4])
{
int *p=&a[0][0],max=a[0][0];
int i,j,k;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
if(max < a[i][j])
max = a[i][j];
}
}
return max;
}
main函数
int main()
{
int a[4][4],*p;
int i,j;
p=&a[0][0];
for(i=0;i<4;i++)
for(j=0;j<4;j++)
scanf("%d",p++);
printf("%d",find_max(a));
return 0;
}
测试
测试输入
1 2 3 5
6 5 4 3
7 9 8 3
120 3 32 23
输出
120
边栏推荐
- 《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
- 浙大版《C语言程序设计实验与习题指导(第3版)》题目集
- Xray and burp linkage mining
- 《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案
- 7-8 7104 Joseph problem (PTA program design)
- 图书管理系统
- Ucos-iii learning records (11) - task management
- Tencent map circle
- Detailed explanation of network foundation routing
- HackMyvm靶机系列(2)-warrior
猜你喜欢

外网打点(信息收集)

Attack and defense world misc practice area (simplerar, base64stego, no matter how high your Kung Fu is, you are afraid of kitchen knives)

Record an edu, SQL injection practice

《统计学》第八版贾俊平第七章知识点总结及课后习题答案

WEB漏洞-文件操作之文件包含漏洞

Binary search tree concept

Library management system

Captcha killer verification code identification plug-in

Statistics, 8th Edition, Jia Junping, Chapter 6 Summary of knowledge points of statistics and sampling distribution and answers to exercises after class

《统计学》第八版贾俊平第十章方差分析知识点总结及课后习题答案
随机推荐
Detailed explanation of network foundation
xray與burp聯動 挖掘
Detailed explanation of three ways of HTTP caching
中间件漏洞复现—apache
Fire! One day transferred to go engineer, not fire handstand sing Conquest (in serial)
小程序web抓包-fiddler
Library management system
7-1 output all primes between 2 and n (PTA programming)
[err] 1055 - expression 1 of order by clause is not in group by clause MySQL
The difference between layer 3 switch and router
Middleware vulnerability recurrence Apache
Hackmyvm Target Series (3) - vues
Attack and defense world misc practice area (GIF lift table ext3)
7-4 hash table search (PTA program design)
Applet Web Capture -fiddler
HackMyvm靶机系列(2)-warrior
Network technology related topics
Binary search tree concept
servlet中 servlet context与 session与 request三个对象的常用方法和存放数据的作用域。
[paper reproduction] cyclegan (based on pytorch framework) {unfinished}