当前位置:网站首页>[pointer] find the value of the largest element in the two-dimensional array
[pointer] find the value of the largest element in the two-dimensional array
2022-07-06 14:35:00 【|Light|】
requirement
Compile a function and program to find the value of the largest element in a two-dimensional array .( Use a pointer to achieve )
Code
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 function
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;
}
test
Test input
1 2 3 5
6 5 4 3
7 9 8 3
120 3 32 23
Output
120
边栏推荐
- [issue 18] share a Netease go experience
- MySQL interview questions (4)
- High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters
- msf生成payload大全
- Numpy快速上手指南
- Based on authorized access, cross host, and permission allocation under sqlserver
- Markdown font color editing teaching
- MySQL learning notes (stage 1)
- Detailed explanation of network foundation
- 函数:求两个正数的最大公约数和最小公倍
猜你喜欢

Binary search tree concept

Captcha killer verification code identification plug-in

servlet中 servlet context与 session与 request三个对象的常用方法和存放数据的作用域。

JDBC事务、批处理以及连接池(超详细)

Record an API interface SQL injection practice

Windows platform mongodb database installation

MySQL中什么是索引?常用的索引有哪些种类?索引在什么情况下会失效?

《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案

链队实现(C语言)

ES全文索引
随机推荐
Intranet information collection of Intranet penetration (3)
captcha-killer验证码识别插件
关于超星脚本出现乱码问题
C language file operation
Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?
Overview of LNMP architecture and construction of related services
《统计学》第八版贾俊平第十三章时间序列分析和预测知识点总结及课后习题答案
Record once, modify password logic vulnerability actual combat
Build domain environment (win)
Data mining - a discussion on sample imbalance in classification problems
Proceedingjoinpoint API use
《統計學》第八版賈俊平第七章知識點總結及課後習題答案
《统计学》第八版贾俊平第二章课后习题及答案总结
msf生成payload大全
《统计学》第八版贾俊平第十四章指数知识点总结及课后习题答案
This article explains in detail how mockmvc is used in practical work
Detailed explanation of network foundation routing
Intranet information collection of Intranet penetration (2)
Attack and defense world misc practice area (GIF lift table ext3)
Always of SystemVerilog usage_ comb 、always_ iff