已知strcpy函数的原型是:char *strcpy(char *dst, const
char *src);实现strcpy函数解释为什么要返回char
*假如考虑dst和src内存重叠的情况,strcpy该怎么实现1.strcpy的实现代码char * strcpy(char *dst,con...
分类:
其他好文 时间:
2014-05-21 21:04:49
阅读次数:
227
1.Q:vector的push_back()方法到底做了些什么? 为什么声明写的是void
push_back (const value_type&
val);A:的确,乍一看,似乎push_back方法添加了一个引用。哦,天啊,如果这个引用对象被析构了,那岂不是要出错。官方文档是这样写的Adds ...
分类:
其他好文 时间:
2014-05-21 20:36:55
阅读次数:
408
#include #include const int GRID_WIDTH = 1024;const
int GRID_HEIGHT = 800;#pragma comment(lib, "osgd.lib")#pragma comment(lib,
"osgViewerd.lib")#pragm...
分类:
其他好文 时间:
2014-05-21 20:31:39
阅读次数:
555
无聊写了个高精度模板玩玩...... 1 /* 2 高精度(压位储存) 3 */ 4
#include 5 #include 6 #include 7 #include 8 #include 9 const int
MAX=10005;//最长长度 10 using ...
分类:
其他好文 时间:
2014-05-21 19:47:19
阅读次数:
588
首先,贴出我给出的解决方案:http://files.cnblogs.com/xuejianhui/utils.rar再则,贴出网上最常见的例子:#include
std::string ws2s(const std::wstring& ws){ std::string curLocale =...
分类:
编程语言 时间:
2014-05-21 18:46:28
阅读次数:
400
一次AC
二维树状数组,有模版很好办
注意二维树状数组这个下标是[1][1]的
#include
#include
#include
#include
#include
#include
using namespace std;
const int Max = 1030;
int row, col, ar[Max][Max];
// 二维的其实下标为[1][1],这个要记得。
...
分类:
其他好文 时间:
2014-05-21 16:23:34
阅读次数:
271
以下内容系原创,转载请务必注明地址
主要参考资料:我在 Stackoverflow 上提的问题 Why
the first is right but the second is wrong ?
这令人纠结的两行代码如下:
const char *cval = "nothing"; // 正确
int *ival = {1, 2, 3, 4}; // 错误...
分类:
其他好文 时间:
2014-05-21 15:32:47
阅读次数:
277
POSIX共享内存相关函数:
shm_open函数
功能:用来创建或打开一个共享内存对象
原型
int shm_open(const char *name, int oflag, mode_t mode);
参数
name:共享内存对象的名字
oflag:与open函数类似,可以是O_RDONLY、O_RDWR,还可以按位或上O_CREAT、O_EXCL、O_T...
分类:
其他好文 时间:
2014-05-21 07:38:19
阅读次数:
324
【题目】
有很多无序的数,从中找出最大的K个数。假定他们都不相等。
【解法一】
如果数据不是很多,例如在几千个左右,我们可以排一下序,从中找出最大的K个数。排序可以选择快速排序或者堆排序
[cpp] view
plaincopy
#include
#include
int cmp(const void *a,const ...
分类:
其他好文 时间:
2014-05-21 07:30:07
阅读次数:
234
POSIX消息队列相关函数:
mq_open函数
功能:用来创建和访问一个消息队列
原型
mqd_t mq_open(const char *name, int oflag);
mqd_t mq_open(const char *name, int oflag, mode_t mode, struct mq_attr *attr);
参数
name: 某个消息队列...
分类:
其他好文 时间:
2014-05-21 06:35:08
阅读次数:
316