易截截图软件、单文件、免安装、纯绿色、仅160KB

c链表示例

C宏实例
摘自Linux内核2.6.21.5源码(部分),展示了链表的另一种实现思路
未采用ANSI C标准,采用GNU C标准,遵从GPL版权许可。
struct list_head {
struct list_head *next, *prev;
};

#define LIST_HEAD_INIT(name) { &(name), &(name) }

#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)

static inline void INIT_LIST_HEAD(struct list_head *list)
{
list->next = list;
list->prev = list;
}

static inline void __list_add(struct list_head *new,
struct list_head *prev,
struct list_head *next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}

static inline void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}

static inline void __list_del(struct list_head * prev, struct list_head * next)
{
next->prev = prev;
prev->next = next;
}


static inline void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
entry->next = NULL;
entry->prev = NULL;
}

#define __list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)

#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member); \
prefetch(pos->member.next), &pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member))
c代码实例
范例代码是双向环形链表的基本操作部分的实例(未包含线程安全机制)全部遵从ANSI C标准
 
//接口声明
#ifndef LLIST_H
#define LLIST_H

typedef void node_proc_fun_t(void*);
typedef int node_comp_fun_t(const void*, const void*);

typedef void LLIST_T;

LLIST_T *llist_new(int elmsize);
int llist_delete(LLIST_T*);

int l


相关文档:

Linux c/c++ 开发工具集锦

我之前是一个C程序员,而且是个Windows的程序员,在windows下使用VC6.0/VS2005等microsoft的傻瓜式工具工作,
对于那个vc 6.0/vs2005的快捷操作,debug操作是那么的熟悉,可以说vc
6.0/vs2005是window下开发c/c++最好用的工具了,可以查看调用堆栈,内存变化情况,变量值,另外安装 visual assist
x后让VC看起来是那么 ......

基于s3c2410和嵌入式Linux的D/A转换的实现


1 引言
在嵌入式应用系统中,特别是智能仪器、仪表、机电设备及装置控制中,需要使用A/D转换将模拟的电量信号转换为数字信号进行处理,而后再将处理的结果通过D/A转换为模拟量实现对被控过程和对象的控制[1]。
基于ARM920T内核的s3c2410是一款低功耗,高性价比的处理器[2]。这款处理器内部集成了多种控制接口,自带8路1 ......

c的一个小问题

/*编写程序,输入2个数以及加减乘除中的某运算符号,并调用自己编写的函数计算相应的结果*/
#include<stdio.h>
#include<conio.h>
float cal(int a,char sym,int b);
main()
{
 int a=0,b=0;
 char sym='\0';
 float c=0.0;
 scanf("%d%c%d",&a,&sym,&b);
 c=c ......

C与C++中字符指针处理字符串

定义一个字符指针,其本质的处理方式是按字符数组处理的,在内存开辟一个字符数组用来存放字符串常量,这样必定会终止符。而这样的特性也仅对于字符指针变量。
在C语言中,通过数组名或者指针变量输出一个字符串,我理解为两个:字符串终止符的存在;以%s格式的输出方式。
char *p="I love china!";
   & ......

使用mex C生成MATLAB的股票数据分析接口

#include "mex.h"
#define DWORD long 
#define NUMBER_OF_STRUCTS (sizeof(friends)/sizeof(struct phonebook))
#define NUMBER_OF_FIELDS (sizeof(field_names)/sizeof(*field_names))
void mexFunction(int nlhs,
    mxArray * plhs[] , int nrhs,const mxArray * pahs[])
{
typedef struc ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号