
C/C++
文章平均质量分 72
xuyongfeng
这个作者很懒,什么都没留下…
展开
-
c++模板实现的队列
/************************************************************************//* 队列节点类原创 2005-08-27 19:20:00 · 1146 阅读 · 0 评论 -
通过#pragma pack(n)改变C编译器的字节对齐方式
#pragma pack(8)struct S1{ char a; long b;};struct S2 { char c; struct S1 d; long long e;};#pragma pack()sizeof(S2)结果为24.成员对齐有一个重要的条件,即每个成员分别对齐.即每个成员按自己的方式对齐.也就是说上面虽然指定了按8字节对齐,但并不是所有的成员都原创 2005-09-03 11:51:00 · 1258 阅读 · 0 评论 -
malloc和calloc区别
Both the malloc() and the calloc() functions are used to allocate dynamic memory. Each operates slightly different from the other. Both the malloc() and the calloc() functions are used to allocate dyn原创 2005-09-03 17:56:00 · 1301 阅读 · 0 评论 -
给出一个函数来输出一个字符串的所有排列。
#include #include #include #include #include #include using namespace std;char *p = "abcde";vector st;/**找index以后的、没有在st中的数。 *如果不存在则返回-1 */int nextVal(int index){ int len = strlen(p); vector::iter原创 2005-09-06 20:09:00 · 3708 阅读 · 0 评论 -
二叉树的后序遍历非递归算法之c++实现
#include #include using namespace std;template class TreeNode{ public: T data; TreeNode *left; //left child TreeNode *right; //right child TreeNode():left(NULL),right(NULL) { }原创 2005-09-05 11:32:00 · 2408 阅读 · 2 评论