上一页 1 ··· 5 6 7 8 9
摘要: #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 阅读(962) 评论(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) 编辑
摘要: #include"stdio.h"struct node{ char name[10]; int prob; };void main(){ //方法1 struct node xiaobo={ .name = "xiaobo", .prob = 13, }; printf("%s**,%d",xiaobo.name,xiaobo.prob); //方法2 struct node xiaobo1={"xiaobo",13}; printf("%s**,%d",xiaobo1.name,xiaobo 阅读全文
posted @ 2011-05-16 12:01 foreverlearn 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 手机按键程序,其中#include"iostream"#include<string>using namespace std;const int MAXN=101;const string press[10] = {"","","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};struct node{ string 阅读全文
posted @ 2011-05-14 22:32 foreverlearn 阅读(178) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"void main(){ int i,j; i = 6; while(i--) { printf("please input/n"); scanf("%d",&j); j = (j&1); printf("output%d/n",j); } system("pause");}注意(j&1)的技巧 按位与运算 0x01 阅读全文
posted @ 2011-05-12 20:04 foreverlearn 阅读(183) 评论(0) 推荐(0) 编辑
摘要: #include"stdio.h"//#include<string>int update(char *s)//修改s本身的值{ s = s + 5; printf("5---%s/n",s); return 0;}int updatechar(char *s)//修改*s指向的值 按引用传递{ //memset(s,'a',5); s[5] = 'a'; s[6] = 'a'; printf("6---%s/n",s); return 0;}int main(){ char 阅读全文
posted @ 2011-05-10 16:55 foreverlearn 阅读(118) 评论(0) 推荐(0) 编辑
摘要: vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令。由于对Unix及Linux系统的任何版本,vi编辑器是完全相同的,因此您可以在其他任何介绍vi的地方进一步了解它。Vi也是Linux中最基本的文本编辑器,学会它后,您将在Linux的世界里畅行无阻。 1、vi的基本概念 基本上vi可以分为三种状态,分别是命令模式(command mode)、插入模式(Insert mode)和底行模式(last line mode),各模式的功能区分如下: 1) 命令行模式command mode) 控制屏幕光标的... 阅读全文
posted @ 2011-05-10 16:00 foreverlearn 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 标签: 无标签memset用法详解(转)memset用法详解(转)2007-01-31 20:00memest原型 (please type "man memset" in your shell) void *memset(void *s, int c, size_t n); memset:作用是在一段内存块中填充某个给定的值,它对较大的结构体或数组进行清零操作的一种最快方法。常见的三种错误第一: 搞反了c 和 n的位置. 一定要记住 如果要把一个char a[20]清零, 一定是 memset(a, 0, 20) 而不是 memset(a, 20, 0) 第二: 过度使用 阅读全文
posted @ 2011-05-05 17:33 foreverlearn 阅读(148) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9