随笔分类 -  C

The C programming language
Algorithm, insert_sort in C
摘要:1 void insert_sort(int arr[], int len) 2 { 3 int i, j; 4 int key; 5 6 for (j=1; j<len; j++) { 7 key = arr[j]; 8 i = j - 1; 9 while (i >= 0 && arr[i] > key) {10 arr[i+1] = arr[i];11 i = i - 1;12 }13 arr[i+1] = key;14 }1... 阅读全文

posted @ 2013-01-17 14:08 operation_master 阅读(130) 评论(0) 推荐(0)

#define in C
摘要:Multi-Statement Macros It's common to write a macro that consists of multiple statements. For example, a timing macro:#define TIME(name, lastTimeVariable) NSTimeInterval now = [[NSProcessInfo processInfo] systemUptime];if(lastTimeVariable) NSLog(@"%s: %f seconds", name, now - lastTimeV 阅读全文

posted @ 2012-12-14 11:28 operation_master 阅读(371) 评论(0) 推荐(1)

structure in C
摘要:/* binary tree node definition */struct tnode{ char *word; /* text at this node */ int count; /* occurrence of this text */ struct tnode *left; /* pointer to next node in the tree */ struct tnode *right; /* pointer to right child */} 阅读全文

posted @ 2012-12-03 11:34 operation_master 阅读(130) 评论(0) 推荐(0)

C, the programming language
摘要:operator precedence: structure member operator . is higher than pointer dereference operator * ;If p is a pointer to a structure, thenp->member-of-structure refers to the particular member. -> is also higher than * ;The two operator above (. and ->), together with () for function calls and 阅读全文

posted @ 2012-06-30 10:07 operation_master 阅读(108) 评论(0) 推荐(0)

导航