下面的代码片段输出是什么?为什么?
char *ptr;
if((ptr = (char *)malloc(0))==NULL)
puts("Got a null pointer");
else
puts("Got a valid pointer");
解析:......故意把0值传给了函数malloc,得到了一个合法的指针,这就是上面的代码,该代码的输出是"Got ...
分类:
其他好文 时间:
2014-06-08 17:11:28
阅读次数:
285
#!/bin/sh
while true
do
ps | grep "my_app" | grep -v "grep" > /dev/null
#第一二个命令输出my_app的运行情况,第二个命令去掉带有grep的条目,然后把结果重定向到null里面不要回显
if [ "$?" -eq 1 ] # 1 : 表示有 ; 0 :表示没有
then
./my_app &...
分类:
系统相关 时间:
2014-06-08 10:06:03
阅读次数:
346
//读取报告数据
string data=null;
using (System.IO.StreamReader sr = new System.IO.StreamReader(filePath, System.Text.Encoding.Default))
{
...
分类:
其他好文 时间:
2014-06-08 08:27:59
阅读次数:
236
//加载数据workflowName onloadmyCgxList: function (id) {
if (id != null && id != "" && typeof (id) != "undefined") { var
param = { "ID": id } $("#myCgxLi.....
分类:
其他好文 时间:
2014-06-08 00:29:54
阅读次数:
296
0.素数计数函数x/ln(x)1.随机化的代码: #include #include
srand((unsigned)time(NULL)); m=rand()%(r-l+1)+l;2.读入一整行字符串 getline(cin,s);
cin.ignore();//忽视一行
分类:
其他好文 时间:
2014-06-07 23:51:54
阅读次数:
400
获取标题,当点击时弹窗 $(document).ready(function(){ var
options = { chart: { plotBackgroundColor: null, plotBorderWidth: null,
plotShadow: fal...
分类:
其他好文 时间:
2014-06-07 23:49:15
阅读次数:
395
1、单个字符也可以表示为字符串,还可以有长度为0的字符串(就是"",空字符串)。null和""的区别,String.IsNullOrEmpty1 string
s = " ";//" "不是empty2 3 //s == "" 相等于...
分类:
其他好文 时间:
2014-06-07 23:39:33
阅读次数:
322
-- 建表CREATE TABLE sale_report ( sale_date DATE NOT
NULL , sale_item VARCHAR(2) NOT NULL , sale_money DECIMAL(10,2) NOT NULL,
PRIMARY KEY(sale_date, sa...
分类:
数据库 时间:
2014-06-07 23:29:17
阅读次数:
502
解决办法: 定义一个MotionEvent对象,在ondown里面赋值 private
MotionEvent mLastOnDownEvent = null; @Override public boolean onDown(MotionEvent
arg0) { mLastOnD...
分类:
其他好文 时间:
2014-06-07 22:45:18
阅读次数:
352
seq(from = 1, to = 1, by = ((to - from)/(length.out
- 1)), length.out = NULL, along.with = NULL,
...)举例----------Examples----------seq(0, 1, length.o....
分类:
其他好文 时间:
2014-06-07 21:47:17
阅读次数:
232