
nginx
linxizi0622
湖南大学研究生,IT男一枚
展开
-
指针和数组的区别
#include #include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char *argv[]) {char a[]="aaaaa";pr原创 2017-06-05 17:55:56 · 259 阅读 · 0 评论 -
c语言中的回调函数
先来一段代码#includevoid show(void(*ptr)()){ (* ptr)(); }void show1(){printf("hello world");}void show2(){printf("ni hao");}int main(){show(show1);printf("\n");show(show2);ret原创 2017-06-02 14:12:38 · 321 阅读 · 0 评论 -
如何取得结构体成员相对于结构体的偏移量
举个例子,有一个结构体typedef struct {char s;int len;}node;我想知道,变量len相对于结构体的偏移量,怎么办?奉上代码#includetypedef struct {char s;int len;}node;int main(){int i=(int)&(((node*)0)->s);printf("%d"原创 2017-06-02 17:55:06 · 643 阅读 · 0 评论 -
nginx中的函数指针的typedef
nginx源码中大量地定义了结构体,结构体中有一些函数指针变量,而这些变量类型都是由typedef定义的新的类型作用就是相当于一个回调函数的作用吧#includetypedef int (*A)(char,char);int a(char x,char y){printf("%c\n",x);printf("%c\n",y);}int b(char x,char y原创 2017-06-03 08:23:39 · 324 阅读 · 0 评论 -
c语言中的指针函数
指针函数,顾名思义,返回值为指针的函数附上代码#include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */int *f(int a,int b){int *p=(int*)malloc(s原创 2017-06-03 11:08:20 · 291 阅读 · 0 评论 -
c语言中的指针数组
指针数组,数组元素是一个指针附上代码#include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */int main(int argc, char *argv[]) {char *conf原创 2017-06-03 13:25:47 · 269 阅读 · 0 评论