C++
gwindm
android
汇编
C/C
VC ;MFC;
ASP.NET(C#)
SQL Server2000
s57
展开
-
函数参数
//------------------------------------------- //能用此指针修改其所指向的值。 void reset(int *p){ *p = 0;}//不能用此指针修改其所指向的值。 void use_ptr(const int *p){}//引用名,就是实参的别名,指向同一个对象。 void原创 2009-01-04 18:58:00 · 176 阅读 · 0 评论 -
函数参数(数组形参)
//-------------------------------------------------//数组形参定义: void printValues(int *) {/* ... */}void printValues(int[]) {/* ... */}void printValues(int[10]{/* ... */} //长度引起误解 //以上三种定义等价原创 2009-01-04 22:10:00 · 164 阅读 · 0 评论 -
内联函数
const string &shorterString(const string &s1, const string &s2){ return s1.size() }看到以上这个函数,我就觉得就一条语句,为何要写成一个函数呢?C++ Primer中的解释是:阅读和理解容易;容易修改;确保统一;可以重用;同时出现另一个问题,就是机器调用函数要做很多工作;原创 2009-01-06 21:50:00 · 153 阅读 · 0 评论 -
函数模板学习一
#include #include using namespace std;//函数模板template inline min(const T &t1, const T &t2);template int compare(const T &v1, const T &v2);template Parm fcn(Parm* array, U value){原创 2009-03-06 14:35:00 · 136 阅读 · 0 评论 -
const 与 指针
const double *cptr;double d = 3.0;cptr = &d;d = 4.0;//*cptr = 5.0;//理解为:自以为指向const对象的指针 const int ci = 40;//int *pi = &ci;const int *cpi = &ci;//如果变量是const的,那么,指向它的指针也一定要是const的原创 2009-03-09 10:27:00 · 116 阅读 · 0 评论 -
赫夫曼编码
#include #include #include typedef struct { unsigned int weight; unsigned int parent, lchild, rchild;}HTNode, *HuffmanTree;typedef char * * HuffmanCode;void Select(HuffmanTree, int,原创 2009-07-01 14:46:00 · 233 阅读 · 0 评论