当前位置:网站首页>Mathematical design D12 according to string function
Mathematical design D12 according to string function
2022-06-26 13:53:00 【Apple ADC】
One . The string src copy to des in
Law 1
void Mystrcpy(char*des,char*src)
{
int i;
for(i=0;src[i]!='\0';i++)//'\0' At the end of the string token
{
des[i]=src[i];
}
des[i]='\0';
} Law 2
char *p=arr;// The array name indicates the address of the first element of the array
Arrays and pointers have the following equations :p[i]==*(p+i); arr[i]==*(arr+i)
void Mystrcpy 1(char*des,char*src)
{
int i;
for(i=0;*(src+i)!='\0';i++)
{
*(des+i)=*(src+i);
}
*(des+i)='\0';
} Law 3
void Mystrcpy 2(char*des,char*src)
{
for(char*p=src;*p!='\0';p++)
{
printf("%c",*p);
}
while(*src!='\0')
{
*des=*src;
src++;
des++;
}
*des='\0';
}Law 4
++ and * Same order operation , The operation order is from right to left
void Mystrcpy 2(char*des,char*src)
{
while(*des++=*src++);
}Two . Find the string length
1. Find the string length directly
#include<string.h>// quote
printf("%d\n",strlen(str));// Output usage 2. Find string str The length of "abcd" by 4, barring '\0', Only the valid length of the string is returned
int Mystrlen(char*str)
{
int i;
for(i=0;str[i]!='\0';i++)
{
}
return i;
}p[i]=*(p+i)
arr[i]=*(arr+i) These can be substituted with the above
边栏推荐
- [hcsd application development training camp] one line of code second cloud evaluation article - experience from the experiment process
- 网络远程访问的方式使用树莓派
- GEE——全球人类居住区网格数据 1975-1990-2000-2014
- 12 SQL optimization schemes summarized by old drivers (very practical)
- [node.js] MySQL module
- awk工具
- Insect operator overloaded a fun
- Pytorch based generation countermeasure Network Practice (7) -- using pytorch to build SGAN (semi supervised GaN) to generate handwritten digits and classify them
- Mysql database explanation (III)
- MySQL explanation (II)
猜你喜欢

Logical operation

Free machine learning dataset website (6300+ dataset)

Pytorch based generation countermeasure Network Practice (7) -- using pytorch to build SGAN (semi supervised GaN) to generate handwritten digits and classify them

ES基於Snapshot(快照)的數據備份和還原

character constants

2021-10-18 character array

Create your own cross domain proxy server

Some conclusions about Nan

Jenkins build prompt error: eacces: permission denied

Wechat applet -picker component is repackaged and the disabled attribute is added -- above
随机推荐
Solutions to the failure of last child and first child styles of wechat applet
Embedded virlog code running process
程序员必备,一款让你提高工作效率N倍的神器uTools
PHP非对称加密算法(RSA)加密机制设计
Mediapipe gestures (hands)
A primary multithreaded server model
There are many contents in the widget, so it is a good scheme to support scrolling
Postman自动化接口测试
A must for programmers, an artifact utools that can improve your work efficiency n times
Network remote access using raspberry pie
5+api, clear application cache
7.Consul服务注册与发现
Exercises under insect STL string
33. Use rgbd camera for target detection and depth information output
微信小程序注册指引
Luogu p3426 [poi2005]sza-template solution
Wechat applet -picker component is repackaged and the disabled attribute is added -- below
GO语言-管道channel
Es sauvegarde et restauration des données par instantané
三维向量的夹角