当前位置:网站首页>Implementation of remove function
Implementation of remove function
2022-07-23 07:37:00 【QQ851301776】
alas , A low-level mistake , An equal sign is missing , Logical judgment becomes an assignment
// Implementation function void remove(char* str1, char* str2).
// function : take str2 The characters appearing in are from str1 Remove from .( for example str1 by ”abcdef”, str2 by ”bde”, After removal str1 Turn into ”acf”.
void remove(char* str1, char* str2)
{
if((!str1) || (!str2)) return ;
char *tmp = (char *)malloc(strlen(str1)+1);
if(!tmp) return ;
int i, j;
int m = 0;
for(i=0; i< strlen(str1); i++)
{
int k = 0;
for(j = 0; j < strlen(str2); j++)
{
if(str1[i] == str2[j]) k++;
}
if(k == 0)
{
tmp[m++] = str1[i];
}
}
memcpy(str1, tmp, m);
str1[m] = '\0';
free(tmp);
tmp = NULL;
return;
}The first time I wrote it , hold

边栏推荐
- 使用Flutter与贝塞尔曲线画一个波浪球
- uniapp切换tab栏显示不同页面并记住页面位置和上拉获取新数据
- 基于证据理论物联网安全态势感知方法研究
- remove函数的实现
- 说说Flutter中的RepaintBoundary
- IP第二次实验 MGRE OSPF
- Are most programmers eliminated after the age of 45? The truth chilled everyone's heart
- 【每日一题】757. 设置交集大小至少为2
- NFT Insider #67:巴塞罗那足球俱乐部推出首个NFT作品,迪拜推出国家元宇宙战略
- Talk about repaintboundary in fluent
猜你喜欢

Attack and defense scheme based on Ethereum status database

Delete the duplicate items in the array (keep the last duplicate elements and ensure the original order of the array)

Nftscan and ATEM network have reached strategic cooperation in the field of NFT data

Codeforces Round #809 (Div. 2) A - D1

小程序毕设作品之微信校园二手书交易小程序毕业设计成品(4)开题报告

GNU LD脚本命令语言(一)

10个Live Demo都展示了啥?看过没看过的都值得再看一遍

网络空间拟态防御发展综述:从拟态概念到“拟态+”生态

【技术科普】联盟链Layer2-论一种新的可能性

使用Flutter与贝塞尔曲线画一个波浪球
随机推荐
直播实录 | 37 手游如何用 StarRocks 实现用户画像分析
支持多数不规则用户的隐私保护联邦学习框架
Unity notes - use of addressables
银行虚拟人技术应用领域及作用介绍
Attack and defense scheme based on Ethereum status database
网络空间拟态防御发展综述:从拟态概念到“拟态+”生态
第二篇如何使用SourceTree更新代码到本地
excel 将图片的链接URL 显示为图片 转
Wechat campus second-hand book trading applet graduation design finished product (7) Interim inspection report
redis常用基础配置文件
Report on the progress of writing Chinese experiments by latex
C language program environment
GNU pseudo instruction definition function
RS485 communication OSI model network layer
A web server where browser users access server files
NFT Insider #67:巴塞罗那足球俱乐部推出首个NFT作品,迪拜推出国家元宇宙战略
7、学习MySQL 选择数据库
Clever use of curl
Vector3.Lerp
String in SQL Server_ Implementation of split function