当前位置:网站首页>[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
- 《统计学》第八版贾俊平第八章假设检验知识点总结及课后习题答案
- Low income from doing we media? 90% of people make mistakes in these three points
- Intranet information collection of Intranet penetration (4)
- Statistics, 8th Edition, Jia Junping, Chapter 11 summary of knowledge points of univariate linear regression and answers to exercises after class
- 1.支付系统
- msf生成payload大全
- 《统计学》第八版贾俊平第三章课后习题及答案总结
- Record an API interface SQL injection practice
- 函数:求方程的根
猜你喜欢
JDBC看这篇就够了
JVM memory model concept
Fundamentals of digital circuit (V) arithmetic operation circuit
High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters
How to earn the first pot of gold in CSDN (we are all creators)
图书管理系统
5分钟掌握机器学习鸢尾花逻辑回归分类
Statistics 8th Edition Jia Junping Chapter 3 after class exercises and answer summary
Statistics 8th Edition Jia Junping Chapter 12 summary of knowledge points of multiple linear regression and answers to exercises after class
《统计学》第八版贾俊平第五章概率与概率分布
随机推荐
Bing Dwen Dwen official NFT blind box will be sold for about 626 yuan each; JD home programmer was sentenced for deleting the library and running away; Laravel 9 officially released | Sifu weekly
5分钟掌握机器学习鸢尾花逻辑回归分类
Xray and burp linkage mining
Only 40% of the articles are original? Here comes the modification method
Network layer - simple ARP disconnection
循环队列(C语言)
C language file operation
Statistics, 8th Edition, Jia Junping, Chapter 6 Summary of knowledge points of statistics and sampling distribution and answers to exercises after class
Statistics 8th Edition Jia Junping Chapter 10 summary of knowledge points of analysis of variance and answers to exercises after class
Statistics 8th Edition Jia Junping Chapter IX summary of knowledge points of classified data analysis and answers to exercises after class
MSF generate payload Encyclopedia
Network technology related topics
Internet Management (Information Collection)
《统计学》第八版贾俊平第八章假设检验知识点总结及课后习题答案
函数:用牛顿迭代法求方程的根
《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
JDBC事务、批处理以及连接池(超详细)
flask实现强制登陆
Statistics 8th Edition Jia Junping Chapter 7 Summary of knowledge points and answers to exercises after class