指针变量的定义和初始化[c][code]
原帖:
http://hi.baidu.com/pepsi360/blog/item/cc74be4412cf6789b3b7dcd4.html
#include <stdio.h>
struct Node
{
int a;
char b[10];
Node *next;
};
main(void)
{
char *p=NULL; //"define NULL 0" included in <stdio.h>
int *q=0; //值0是唯一能够直接赋给指针变量的整数值
double *d;
Node *pNode=NULL;
d=NULL;
return 0;
}
以上代码在VC环境下调试运行。
step1. 运行完语句Node *pNode=NULL;后:
Name Value
+ &p 0x0012ff7c ""
+ &q 0x0012ff78 ""
+ &d 0x0012ff74 ""
+ &pNode 0x0012ff70 ""
Memory:
0012FF66 CC CC CC CC CC CC CC CC CC CC 00 烫烫烫烫烫.
0012FF71 00 00 00 CC CC CC CC 00 00 00 00 ...烫烫....
0012FF7C 00 00 00 00 C0 FF 12 00 39 11 40 ........9.@
step2. 运行完语句d=NULL;后:
Name Value
+ &p 0x0012ff7c ""
+ &q 0x0012ff78 ""
+ &d 0x0012ff74 ""
+ &pNode 0x0012ff70 ""
Memory:
0012FF66 CC CC CC CC CC CC CC CC CC CC 00 烫烫烫烫烫.
0012FF71 00 00 00 00 00 00 00 00 00 00 00 ...烫烫....
0012FF7C 00 00 00 00 C0 FF 12 00 39 11 40 ........9.@
在Turbo C中的代码如下:
#include <stdio.h>
struct Node
{
int a;
char b[10];
struct Node *next; /* struct不能少 */
};
main(void)
{
char *p=NULL; /* "define NULL 0" included in <stdio.h> */
int *q=0;
&
相关文档:
{
SqlConnection cnn = new SqlConnection
("context connection=true");
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "select * from customers";
SqlDataReader reader = cmd.ExecuteReader();
SqlContext.Pipe.Send(reader);
reader.Close();
cnn.Close();
}
......
[C/C++ Digestion] – Rule of Three,
复制控制
作者:
Jason Lee @
http://blog.csdn.net/jasonblog
日期:
2010-04-13
[1]
复制构造函数
copy constructor
Rule of Three
是指类如果需要析构函数,则通常也需要复制构造函数和赋值操作符。而其实习惯地显示编写这三者本就是一个良好的习惯。因 ......
使用 gperf 实现高效的 C/C++ 命令行处理
GNU 完美(gperf)散列函数生成器简化复杂的输入字符串
文档选项
级别: 中级
Arpan Sen
(arpan@syncad.com
), 技术主管, Synapti Computer Aided Design Pvt Ltd
2007 年 9 月 10 日
GNU 的 gperf 工具是一种 “完美的” 散列函数,可以为用户提供的一组特 ......
我觉得,在输入输出函数中,scanf()函数,应该是最麻烦的,有时它给我们的结果很可笑,但是一定是一原因的....
首先声明一下,这篇日志不是介绍scanf()中各种格式符用法的文章(没有这个必要,但是大家一定要会用).
我尝试了很多种输入,包括一些错误的练习,曾经对scanf()由迷茫转向清醒,又由清醒再次转向迷茫......不知道何时是个 ......