字符串拷贝记得strcpy

简介:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
using  namespace  std;
 
int  main()
{
     char  *p= new  char [10];
//  *p="zds"    错误
     strcpy (p, "zds" );
     char  *q= new  char [10];
//  q=p   错误
//  *q=*p; 错误
     strcpy (q,p);
     cout<<p<<endl;
     cout<<q<<endl;
     return  0;
}
相关文章
|
3天前
|
C语言
[字符串和内存函数]strcpy和strncpy的区别
[字符串和内存函数]strcpy和strncpy的区别
20 0
|
7月前
|
C语言
你应该知道的C语言干货(2)(strlen和strcpy的模拟实现)
你应该知道的C语言干货(2)(strlen和strcpy的模拟实现)
33 0
|
3天前
|
安全 C语言
【C语言】strcpy与strncpy函数的使用和模拟实现
【C语言】strcpy与strncpy函数的使用和模拟实现
5 0
|
3天前
|
C语言
【C语言】字符串函数strcpy&&strcat&&strcmp&&strstr的使⽤和模拟实现2
【C语言】字符串函数strcpy&&strcat&&strcmp&&strstr的使⽤和模拟实现
|
3天前
|
存储 C语言
【C语言】字符串函数strcpy&&strcat&&strcmp&&strstr的使⽤和模拟实现1
【C语言】字符串函数strcpy&&strcat&&strcmp&&strstr的使⽤和模拟实现
|
3天前
|
编译器 C语言 C++
【C语言】strcpy()函数(字符串拷贝函数详解)
【C语言】strcpy()函数(字符串拷贝函数详解)
36 1
|
6月前
|
C++
关于在vs中一劳永逸解决使用scanf, strcpy等函数的方法
关于在vs中一劳永逸解决使用scanf, strcpy等函数的方法
|
8月前
|
存储
串拷贝(strcpy)和内存拷贝(memcpy)
串拷贝(strcpy)和内存拷贝(memcpy)
44 0
|
9月前
|
C语言
【C语言进阶】-- 重点字符串函数内存函数及其模拟实现(strlen,strcmp,strcat...memcpy,memmove)
【C语言进阶】-- 重点字符串函数内存函数及其模拟实现(strlen,strcmp,strcat...memcpy,memmove)
|
11月前
|
编译器 C语言
C语言strlen,strcpy ,strcat, strcmp,strstr常用库函数的理解与模拟实现
C语言strlen,strcpy ,strcat, strcmp,strstr常用库函数的理解与模拟实现
103 0