当前位置:网站首页>[pointer] find the length of the string
[pointer] find the length of the string
2022-07-06 14:36:00 【|Light|】
requirement
Make up a function , Find the length of the string .( Use a pointer to achieve )
Code
/* * This function is used to calculate formal parameters a The length of the string pointed to * The calculated string length is returned as a function value * notes : System library functions cannot be used */
int str_len(char *a)
{
int len=0;
for(int i=0;i<300;i++)
{
if(a[i]=='\0')
break;
else
len++;
}
return len;
}
main function
int main()
{
char a[300];
int n;
gets(a);
n=str_len(a);
printf("%d\n",n);
return 0;
}
test
Test input
Those engraved in the chair behind the love, will not like the cement on the flowers, out of no wind, lonely forest.
Output
116
边栏推荐
- Load balancing ribbon of microservices
- JDBC transactions, batch processing, and connection pooling (super detailed)
- Intranet information collection of Intranet penetration (4)
- 《统计学》第八版贾俊平第八章假设检验知识点总结及课后习题答案
- Detailed explanation of network foundation
- 线程的实现方式总结
- 【指针】使用插入排序法将n个数从小到大进行排列
- [pointer] use the insertion sorting method to arrange n numbers from small to large
- Intranet information collection of Intranet penetration (I)
- Intranet information collection of Intranet penetration (5)
猜你喜欢

Fundamentals of digital circuit (V) arithmetic operation circuit

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

Apache APIs IX has the risk of rewriting the x-real-ip header (cve-2022-24112)

《统计学》第八版贾俊平第二章课后习题及答案总结

Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class

Intranet information collection of Intranet penetration (3)

内网渗透之内网信息收集(三)

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

《统计学》第八版贾俊平第三章课后习题及答案总结

Statistics 8th Edition Jia Junping Chapter 12 summary of knowledge points of multiple linear regression and answers to exercises after class
随机推荐
《英特尔 oneAPI—打开异构新纪元》
AQS details
Internet Management (Information Collection)
《統計學》第八版賈俊平第七章知識點總結及課後習題答案
5分钟掌握机器学习鸢尾花逻辑回归分类
Pointers: maximum, minimum, and average
Constants, variables, and operators of SystemVerilog usage
Apache APIs IX has the risk of rewriting the x-real-ip header (cve-2022-24112)
攻防世界MISC练习区(gif 掀桌子 ext3 )
数字电路基础(三)编码器和译码器
Markdown font color editing teaching
Statistics, 8th Edition, Jia Junping, Chapter VIII, summary of knowledge points of hypothesis test and answers to exercises after class
Statistics 8th Edition Jia Junping Chapter 7 Summary of knowledge points and answers to exercises after class
《统计学》第八版贾俊平第十章方差分析知识点总结及课后习题答案
【指针】求解最后留下的人
. Net6: develop modern 3D industrial software based on WPF (2)
Numpy Quick Start Guide
Statistics 8th Edition Jia Junping Chapter 12 summary of knowledge points of multiple linear regression and answers to exercises after class
Interview Essentials: what is the mysterious framework asking?
【指针】数组逆序重新存放后并输出