当前位置:网站首页>[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
边栏推荐
- Function: find 1-1/2+1/3-1/4+1/5-1/6+1/7-... +1/n
- Based on authorized access, cross host, and permission allocation under sqlserver
- ES全文索引
- 数字电路基础(四) 数据分配器、数据选择器和数值比较器
- 《統計學》第八版賈俊平第七章知識點總結及課後習題答案
- 《统计学》第八版贾俊平第五章概率与概率分布
- Apache APIs IX has the risk of rewriting the x-real-ip header (cve-2022-24112)
- Fire! One day transferred to go engineer, not fire handstand sing Conquest (in serial)
- 四元数---基本概念(转载)
- Intel oneapi - opening a new era of heterogeneity
猜你喜欢
Circular queue (C language)
《英特尔 oneAPI—打开异构新纪元》
关于超星脚本出现乱码问题
数据库多表链接的查询方式
Interview Essentials: what is the mysterious framework asking?
Low income from doing we media? 90% of people make mistakes in these three points
数字电路基础(四) 数据分配器、数据选择器和数值比较器
Statistics 8th Edition Jia Junping Chapter IX summary of knowledge points of classified data analysis and answers to exercises after class
Hackmyvm target series (1) -webmaster
Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class
随机推荐
《统计学》第八版贾俊平第十四章指数知识点总结及课后习题答案
Attack and defense world misc practice area (GIF lift table ext3)
servlet中 servlet context与 session与 request三个对象的常用方法和存放数据的作用域。
指针:最大值、最小值和平均值
浙大版《C语言程序设计实验与习题指导(第3版)》题目集
AQS details
指針:最大值、最小值和平均值
Captcha killer verification code identification plug-in
Statistics 8th Edition Jia Junping Chapter 7 Summary of knowledge points and answers to exercises after class
《统计学》第八版贾俊平第八章假设检验知识点总结及课后习题答案
2022华中杯数学建模思路
指针--剔除字符串中的所有数字
5 minutes to master machine learning iris logical regression classification
The difference between layer 3 switch and router
《統計學》第八版賈俊平第七章知識點總結及課後習題答案
Circular queue (C language)
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
Statistics, 8th Edition, Jia Junping, Chapter 6 Summary of knowledge points of statistics and sampling distribution and answers to exercises after class
Network layer - simple ARP disconnection
Wu Enda's latest interview! Data centric reasons