当前位置:网站首页>[pointer] find the largest string
[pointer] find the largest string
2022-07-06 14:36:00 【|Light|】
requirement
Make up a function , Find the largest string .( Use a pointer to achieve )
Code
#include<string.h>
#include<stdlib.h>
/* * This function is used to find n The largest of the strings * a Is a two-dimensional character array , Each line holds a string ,n Is the number of strings with lookup */
char * find_max_string(char a[][300],int n)
{
char *pmax;
int i, j = 0, k;
for (i = 0; i < n; i++)
{
k = strcmp(a[j],a[i]);
if (k < 0)
{
j = i;
}
}
pmax = &a[j-1][300];
return pmax;
}
main function
int main()
{
char a[10][300]={
0},*p;
int n=0;
while(gets(a[n])!=NULL){
n++;
}
p=find_max_string(a,n);
puts(p);
return 0;
}
test
Test input
I love China
I Love China
I have dream
Output
I love China
边栏推荐
- 内网渗透之内网信息收集(四)
- 使用 flask_whooshalchemyplus jieba实现flask的全局搜索
- “人生若只如初见”——RISC-V
- 《统计学》第八版贾俊平第十一章一元线性回归知识点总结及课后习题答案
- 【指针】求解最后留下的人
- Numpy快速上手指南
- An unhandled exception occurred when C connected to SQL Server: system Argumentexception: "keyword not supported:" integrated
- 【指针】数组逆序重新存放后并输出
- 我的第一篇博客
- 5 minutes to master machine learning iris logical regression classification
猜你喜欢

Sqqyw (indifferent dot icon system) vulnerability recurrence and 74cms vulnerability recurrence

JDBC transactions, batch processing, and connection pooling (super detailed)

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

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

DVWA (5th week)

Statistics 8th Edition Jia Junping Chapter IX summary of knowledge points of classified data analysis and answers to exercises after class

ES全文索引

数据库多表链接的查询方式

Record an edu, SQL injection practice

后台登录系统,JDBC连接数据库,做小案例练习
随机推荐
Circular queue (C language)
. Net6: develop modern 3D industrial software based on WPF (2)
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 IX summary of knowledge points of classified data analysis and answers to exercises after class
captcha-killer验证码识别插件
《統計學》第八版賈俊平第七章知識點總結及課後習題答案
数字电路基础(三)编码器和译码器
MSF generate payload Encyclopedia
Lintcode logo queries the two nearest saplings
[pointer] counts the number of times one string appears in another string
【指针】统计一字符串在另一个字符串中出现的次数
How does SQLite count the data that meets another condition under the data that has been classified once
Hackmyvm target series (2) -warrior
函数:用牛顿迭代法求方程的根
Uibutton status exploration and customization
Hcip -- MPLS experiment
5分钟掌握机器学习鸢尾花逻辑回归分类
Statistics, 8th Edition, Jia Junping, Chapter 11 summary of knowledge points of univariate linear regression and answers to exercises after class
2022华中杯数学建模思路