当前位置:网站首页>【指针】求二维数组中最大元素的值
【指针】求二维数组中最大元素的值
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
边栏推荐
- How to understand the difference between technical thinking and business thinking in Bi?
- The most popular colloquial system explains the base of numbers
- Only 40% of the articles are original? Here comes the modification method
- 7-5 staircase upgrade (PTA program design)
- Feature extraction and detection 14 plane object recognition
- 记一次,修改密码逻辑漏洞实战
- 《统计学》第八版贾俊平第三章课后习题及答案总结
- 《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
- Sqqyw (indifferent dot icon system) vulnerability recurrence and 74cms vulnerability recurrence
- New version of postman flows [introductory teaching chapter 01 send request]
猜你喜欢
Statistics 8th Edition Jia Junping Chapter IX summary of knowledge points of classified data analysis and answers to exercises after class
Applet Web Capture -fiddler
《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案
Chain team implementation (C language)
DVWA (5th week)
Statistics 8th Edition Jia Junping Chapter 10 summary of knowledge points of analysis of variance and answers to exercises after class
记一次,修改密码逻辑漏洞实战
Build domain environment (win)
Statistics 8th Edition Jia Junping Chapter 5 probability and probability distribution
关于超星脚本出现乱码问题
随机推荐
What language should I learn from zero foundation. Suggestions
Network layer - simple ARP disconnection
SQL injection
Only 40% of the articles are original? Here comes the modification method
《统计学》第八版贾俊平第三章课后习题及答案总结
XSS (cross site scripting attack) for security interview
Markdown font color editing teaching
Applet Web Capture -fiddler
Intel oneapi - opening a new era of heterogeneity
《英特尔 oneAPI—打开异构新纪元》
网络层—简单的arp断网
Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class
7-9 make house number 3.0 (PTA program design)
内网渗透之内网信息收集(四)
Windows platform mongodb database installation
Hackmyvm target series (3) -visions
外网打点(信息收集)
C language file operation
[err] 1055 - expression 1 of order by clause is not in group by clause MySQL
7-11 mechanic mustadio (PTA program design)