当前位置:网站首页>【指针】求二维数组中最大元素的值
【指针】求二维数组中最大元素的值
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
边栏推荐
- Circular queue (C language)
- Low income from doing we media? 90% of people make mistakes in these three points
- Internet Management (Information Collection)
- Middleware vulnerability recurrence Apache
- Record an API interface SQL injection practice
- 7-14 error ticket (PTA program design)
- Statistics 8th Edition Jia Junping Chapter 10 summary of knowledge points of analysis of variance and answers to exercises after class
- Record an edu, SQL injection practice
- Realize applet payment function with applet cloud development (including source code)
- Hackmyvm target series (4) -vulny
猜你喜欢

. Net6: develop modern 3D industrial software based on WPF (2)

Résumé des points de connaissance et des réponses aux exercices après la classe du chapitre 7 de Jia junping dans la huitième édition des statistiques

xray与burp联动 挖掘

攻防世界MISC练习区(gif 掀桌子 ext3 )

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

"Gold, silver and four" job hopping needs to be cautious. Can an article solve the interview?

Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?
![Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]](/img/0b/ddbee0b8a34627e13bff5598bbaed8.jpg)
Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]

Record once, modify password logic vulnerability actual combat

Intranet information collection of Intranet penetration (5)
随机推荐
How to earn the first pot of gold in CSDN (we are all creators)
Statistics 8th Edition Jia Junping Chapter IX summary of knowledge points of classified data analysis and answers to exercises after class
《统计学》第八版贾俊平第六章统计量及抽样分布知识点总结及课后习题答案
Database monitoring SQL execution
Record an edu, SQL injection practice
关于超星脚本出现乱码问题
7-4 hash table search (PTA program design)
Detailed explanation of three ways of HTTP caching
《統計學》第八版賈俊平第七章知識點總結及課後習題答案
《统计学》第八版贾俊平第五章概率与概率分布
Library management system
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
Hackmyvm target series (5) -warez
Always of SystemVerilog usage_ comb 、always_ iff
《英特尔 oneAPI—打开异构新纪元》
Feature extraction and detection 14 plane object recognition
Lintcode logo queries the two nearest saplings
Only 40% of the articles are original? Here comes the modification method
Detailed explanation of network foundation
Xray and Burp linked Mining