一.内存对齐的初步讲解内存对齐可以用一句话来概括:“数据项只能存储在地址是数据项大小的整数倍的内存位置上”例如int类型占用4个字节,地址只能在0,4,8等位置上。例1:#include
struct xx{ char b; int a; int c; char d;};int main(){ st...
分类:
其他好文 时间:
2014-05-10 19:52:54
阅读次数:
323
BFS。wa了一下午,原来是YES,写成了Yes。 1 #include 2 #include 3
#include 4 #include 5 using namespace std; 6 7 typedef struct node_st{ 8 int x,
y; 9 in...
分类:
其他好文 时间:
2014-05-06 08:48:16
阅读次数:
274
epoll函数#include int epoll_create(int size)int
epoll_ctl(int epfd, int op, int fd, struct epoll_event *event)int epoll_wait(int
epfd,struct epoll_event...
分类:
其他好文 时间:
2014-05-06 00:21:30
阅读次数:
519
题目链接区间合并,贪心,需要注意边界情况,LeetCode的数据还是比较好的,这样才能写出健壮的程序。附上代码:
1 /** 2 * Definition for an interval. 3 * struct Interval { 4 * int start; 5 *
in...
分类:
其他好文 时间:
2014-05-06 00:16:44
阅读次数:
400
输入子系统在内核中的位置:/driver/input
drivers/input/input.c: input_init ---> err = register_chrdev(INPUT_MAJOR,
"input", &input_fops); static const struct file_o...
分类:
其他好文 时间:
2014-05-05 23:34:42
阅读次数:
516
编程语言更迭至今,几乎没有人没有用过一门不用垃圾回收的语言,一方面因为C之类的语言内存管理较为困难,更重要的是因为语言越高级,越注重实际的业务逻辑,而关于内存管理的代码频繁夹杂在业务中,并不那么自然。###
没有垃圾回收的编程体验 #include #include struct node { .....
分类:
其他好文 时间:
2014-05-05 21:49:59
阅读次数:
329
??
#include
#include
typedef struct emp{
char sex[8];
char name[15];
int age;
}*emp;//这里我们用typedef把emp这个结构体变成了*emp这种指向结构体成员的结构体指针
/*typedef struct emp{
char sex[8];
char name[15];
int...
分类:
编程语言 时间:
2014-05-05 12:54:29
阅读次数:
277
// BTree.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include"stdlib.h"
#include"malloc.h"
#define BT BTreeNode
#define MS 10
typedef struct BT{
char data;
struct BT *left;
struct BT *right;
}BT;
...
分类:
其他好文 时间:
2014-05-04 12:45:34
阅读次数:
365
//非递归遍历一棵树 需要借助栈
#include
#include
struct Tree
{
int nValue;
Tree *pLeft;
Tree *pRight;
};
struct Stack
{
Tree *root;
Stack *pNext;
};
Stack *pStack = NULL;
void push(Tree *root)
{
St...
分类:
其他好文 时间:
2014-05-03 20:55:41
阅读次数:
325
#include
#include
#include
#include
#include
using namespace std;
#define N 20020
struct node{
int from, to, dou, nex;
}edge[N];
int head[N], edgenum;
void add(int u, int v,int dou){
node E={u,v,dou...
分类:
其他好文 时间:
2014-05-03 15:25:32
阅读次数:
340