摘要: #define USB_MAXBUS 64struct usb_busmap{ unsigned long busmap[USB_MAXBUS/(8*sizeof(unsigned long))];};void main(){ printf("%ld/n",sizeof(unsigned long));}/* 相当于long占的字节数*(64/(8*long占的字节数))不论在什么平台下都是busmap都是四个字节的长度 32位*/ 阅读全文
posted @ 2011-05-19 21:19 foreverlearn 阅读(138) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"#include"malloc.h"#include <stdlib.h>//int 4字节,char 1个字节struct node{ int member1; char member2[10]; int member3[0];//变长数组};void main(){ struct node *xiaobo1; //printf("%d",sizeof( struct node)); xiaobo1 = malloc(sizeof(struct node)+3*sizeof(int)); 阅读全文
posted @ 2011-05-19 16:03 foreverlearn 阅读(964) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"void fun(int x){ printf("函数指针%d/n",x);}struct node{ char name[20]; int prob; void (*f)(int x);//函数指针 };void main(){ //方法1 struct node xiaobo={ .name = "xiaobo", .prob = 0, .f = fun, }; printf("%s**,%d",xiaobo.name,xiaobo.prob); ... 阅读全文
posted @ 2011-05-19 16:00 foreverlearn 阅读(293) 评论(0) 推荐(0) 编辑