自定义一个strcpy函数
来源:互联网 发布:hecras软件中堰流系数 编辑:程序博客网 时间:2024/05/20 18:20
#include<stdio.h>
#include<string.h>
#include<Windows.h>
#include<assert.h>
//自定义一个strcpy函数
char * my_strcpy(char* dest,const char* src )
{
assert(dest!=NULL);
assert(src!=NULL);
while(*src!='\0')
{
*dest = *src;
dest++;
src++;
}
*dest = *src;
}
int main()
{
char *p = "hello world";
char arr[20]={0};
my_strcpy(arr,p);
printf("%s\n",arr);
system("pause");
return 0;
}
#include<string.h>
#include<Windows.h>
#include<assert.h>
//自定义一个strcpy函数
char * my_strcpy(char* dest,const char* src )
{
assert(dest!=NULL);
assert(src!=NULL);
while(*src!='\0')
{
*dest = *src;
dest++;
src++;
}
*dest = *src;
}
int main()
{
char *p = "hello world";
char arr[20]={0};
my_strcpy(arr,p);
printf("%s\n",arr);
system("pause");
return 0;
}
阅读全文
0 0
- 自定义一个strcpy函数
- 实现一个strcpy函数
- 编写一个标准strcpy函数
- 自定义strcpy函数时出现的问题
- 关于strcpy函数的自定义实现
- 自定义字符串函数:strlen,strcat,strcpy,strcmp
- 自定义字符串函数:strlen,strcat,strcpy,strcmp
- 一个典型的strcpy函数错误
- 如何写一个漂亮的strcpy函数
- 自己写的一个strcpy函数
- 写一个strcpy函数的实现
- 只是一个函数的问题strcpy
- strcpy函数
- strcpy函数
- strcpy函数
- strcpy()函数
- strcpy() 函数
- strcpy函数
- shell脚本篇二---shell脚本写作
- Java学习笔记(三)—— JDBC封装
- Openfiler配置RAC共享存储
- 欢迎使用CSDN-markdown编辑器
- 【刷题算法】寻找岛的个数
- 自定义一个strcpy函数
- Openfiler2.99图文教程2--搭建NFS
- 第3条:用私有构造器或者枚举类型强化Singleton属性
- Java多线程复制大文件
- leetcode 386. Lexicographical Numbers
- 两个重叠模型模拟双pass,顺便解决透明乱序问题
- C++引用与复制构造函数
- Markdown模板
- redis--基本概念