摘要: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...
阅读全文
摘要: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
阅读全文
摘要:/* 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 */}
阅读全文
摘要: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
阅读全文