当前位置:网站首页>[pointer] delete all spaces in the string s
[pointer] delete all spaces in the string s
2022-07-06 14:35:00 【|Light|】
requirement
Make up a function , Delete string s All spaces in .( Use a pointer to achieve )
Code
/* This function is used to delete all spaces in the string a Is a pointer to a string array */
char *delete_space(char *a)
{
int n = strlen(a);
int i=0,j=0,k=0;
char b[n];
for(i=0;i<n;i++)
{
if(a[i]==' ')
{
k++;
continue;
}
else
{
b[j]=a[i];
j++;
a[i]='\0';
}
}
for(j=0;j<n-k;j++)
{
a[j]=b[j];
}
return a;
}
main function
int main()
{
char a[200];
gets(a);
delete_space(a);
puts(a);
return 0;
}
test
Test input
I A m A Student
Output
IAmAStudent
边栏推荐
- 攻防世界MISC练习区(SimpleRAR、base64stego、功夫再高也怕菜刀)
- 《统计学》第八版贾俊平第七章知识点总结及课后习题答案
- Build domain environment (win)
- 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
- Sentinel overall workflow
- MySQL interview questions (4)
- 内网渗透之内网信息收集(二)
- Library management system
- Function: find 1-1/2+1/3-1/4+1/5-1/6+1/7-... +1/n
- “人生若只如初见”——RISC-V
猜你喜欢
High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters
Realize applet payment function with applet cloud development (including source code)
Detailed explanation of network foundation
Library management system
《统计学》第八版贾俊平第七章知识点总结及课后习题答案
How does SQLite count the data that meets another condition under the data that has been classified once
SystemVerilog discusses loop loop structure and built-in loop variable I
图书管理系统
Markdown font color editing teaching
Statistics, 8th Edition, Jia Junping, Chapter 6 Summary of knowledge points of statistics and sampling distribution and answers to exercises after class
随机推荐
网络基础详解
移植蜂鸟E203内核至达芬奇pro35T【集创芯来RISC-V杯】(一)
链队实现(C语言)
Attack and defense world misc practice area (simplerar, base64stego, no matter how high your Kung Fu is, you are afraid of kitchen knives)
Overview of LNMP architecture and construction of related services
Always of SystemVerilog usage_ comb 、always_ iff
Uibutton status exploration and customization
How does SQLite count the data that meets another condition under the data that has been classified once
函数:计算字符串中大写字母的个数
Statistics 8th Edition Jia Junping Chapter 12 summary of knowledge points of multiple linear regression and answers to exercises after class
《统计学》第八版贾俊平第七章知识点总结及课后习题答案
Based on authorized access, cross host, and permission allocation under sqlserver
Statistics, 8th Edition, Jia Junping, Chapter 11 summary of knowledge points of univariate linear regression and answers to exercises after class
JVM memory model concept
On the idea of vulnerability discovery
AQS details
Wu Enda's latest interview! Data centric reasons
函数:求1-1/2+1/3-1/4+1/5-1/6+1/7-…+1/n
msf生成payload大全
《统计学》第八版贾俊平第二章课后习题及答案总结