01 2012 档案

摘要:http://stackoverflow.com/questions/8774567/c-macro-to-create-a-bit-mask-possible-and-have-i-found-a-gcc-bug 阅读全文
posted @ 2012-01-08 14:36 lxk613 阅读(136) 评论(0) 推荐(0)
摘要:http://stackoverflow.com/questions/2583580/what-is-the-best-way-to-write-class-template-like-generic-code-in-cstruct list_element_s{void* data;struct list_element_s next;};typedef struct list_element_s list_element;struct list_s{void (*destructor)(void* data);int (*com)(const void *src,const void* . 阅读全文
posted @ 2012-01-06 17:06 lxk613 阅读(210) 评论(0) 推荐(0)
摘要:View Code typedef struct LList LList; struct LList { int value; LList *next; }; LList *(*p)[3]; /* pointer to an array of 3 pointers to LList */ LList ll1 = {11}; LList ll2 = {22}; LList ll3 = {33}; size_t sizeofarray = sizeof*p/sizeof**p; /* calc arraysize at runtime here */ p = malloc( sizeofarra. 阅读全文
posted @ 2012-01-02 14:23 lxk613 阅读(267) 评论(0) 推荐(0)
摘要:创建多维数组,并差创建数组指针进行操作View Code #include <stdio.h> int main(int argc, char **argv) { int shape1[5][3] = {1,0,0, 1,0,0, 1,0,0, 1,0,0, 1,0,0}; int shape2[5][3] = {0,0,0, 0,0,0, 0,1,1, ... 阅读全文
posted @ 2012-01-01 16:46 lxk613 阅读(435) 评论(0) 推荐(0)
摘要:View Code #include <stdio.h>int main (void) { arrayPointer(); int arr[3] = {11,3,4}; int *p1; char *p2=(char*)arr; int i; int size1=sizeof(arr)/sizeof(arr[0]); int size2=(int)sizeof(arr); p1 = arr; printf("*p1=%d,size1=%d\n", *p1,size1); printf("*p2=%d,size2=%d\n"... 阅读全文
posted @ 2012-01-01 16:05 lxk613 阅读(258) 评论(0) 推荐(0)