#include
#include
using namespace std;
class string1
{
private:
char *str;
public:
string1(const char *s)
{
str = new char[strlen(s) + 1];
strcpy(str,s);
cout<<"str...
分类:
编程语言 时间:
2015-04-09 17:23:38
阅读次数:
132
#include
#include
using namespace std;
class A
{
private:
char *a;
public:
A(char *aa)
{
a = new char[strlen(aa)+1]; //(a)这样处理的意义在于:为aa指针开辟出空间
strcpy(a, aa); /...
分类:
其他好文 时间:
2015-04-09 15:30:44
阅读次数:
109
用最新的visual studio编译有些以前的代码,sprintf、strcpy、wcstombs等函数会因为内存泄漏问题而被报error4996,编译器要求使用_s版本的,只需要在预处理器定义中增加:_SCL_SECURE_NO_WARNINGS_CRT_SECURE_NO_DEPRECATE如...
分类:
其他好文 时间:
2015-04-09 10:20:38
阅读次数:
103
三大字符处理函数实现||||
==--==--==--==--==--==--
strlen , strcpy, strcmp....
分类:
其他好文 时间:
2015-04-08 18:01:47
阅读次数:
110
在Linux下编写一下代码:
#include
#include
char Lbuffer[] = "01234567890123456789========ABCD";
void foo()
{
char buff[16];
strcpy (buff, Lbuffer);
}
int main(int argc, char * argv[])
{
foo();...
分类:
其他好文 时间:
2015-04-07 19:40:53
阅读次数:
128
http://www.cnblogs.com/fangyukuan/archive/2010/09/18/1830493.html一.找错题试题1:voidtest1(){ charstring[10]; char*str1="0123456789"; strcpy(string, str1 );}...
分类:
编程语言 时间:
2015-04-07 13:22:42
阅读次数:
188
http://www.cnblogs.com/chio/archive/2009/08/01/1536628.html//============================================================================// Name : Hel...
分类:
其他好文 时间:
2015-04-06 16:57:32
阅读次数:
133
编译不能通过
#include "iostream"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char *p= "hello" ; //不是把一个字符串赋给了一个字符型的指针,而是把一个字符型的指针指向了字符串的首地址。
strcpy(p,"hel");
cout << p << endl;
return...
分类:
其他好文 时间:
2015-04-05 23:37:28
阅读次数:
334
1. 求一个数的二进制中的1的个数。int func(int x){ int count = 0; while (x) { count++; x = x& (x - 1); } return count; }2.已知strcpy的函数原...
分类:
编程语言 时间:
2015-04-05 23:23:18
阅读次数:
241
string.hextern int strcmp(const char*,const char*);extern char* strcpy(char*,const char*);string.cint strcmp(const char *cs, const char *ct){ unsig...
分类:
编程语言 时间:
2015-04-05 15:58:44
阅读次数:
173