渔舟唱晚的天空
——welkinwalker的遐想
摘要: strcpy和memcpy的区别只要在于两点:1,memcpy要指定需要拷贝的字节数量2,strcpy按照c-style字符串的方式来拷贝,也就是意味着他在碰到\0的时候会自动终止,而memcpy不会,他会原封不动的拷贝数据。memcpy和memmove的区别主要在于,memmove能够正确处理起始地址和结束地址重合的情况,而memcpy不能,例子如下:#include <iostream>using namespace std;main(){ char bufa[10]; char bufb[10]; strcpy(bufa,"0123456789&qu 阅读全文
posted @ 2011-02-10 23:03 welkinwalker 阅读(834) 评论(0) 推荐(0) 编辑
摘要: 一个小例子,说明类的几大函数:#include <iostream>using namespace std;class c_test{ public: c_test(); c_test(int para_a=3,string str="original"); c_test(const c_test & other); ~c_test(void); c_test & operator =(const c_test & other); private: string name; int num;};c_ 阅读全文
posted @ 2011-02-10 20:43 welkinwalker 阅读(283) 评论(0) 推荐(0) 编辑