PowerPoint Presentation

Size: px
Start display at page:

Download "PowerPoint Presentation"

Transcription

1 Chapter 7 Pointers ( 指標 ) 1 Outline 7.1 Introduction 7.2 Pointer Variable Definitions and Initialization 7.3 Pointer Operators 7.4 Calling Functions by Reference 7.5 Using the const Qualifier with Pointers 7.6 Bubble Sort Using Call by Reference 7.7 Pointer Expressions and Pointer Arithmetic 7.8 The Relationship between Pointers and Arrays 7.9 Arrays of Pointers 7.10 Case Study: A Card Shuffling and Dealing Simulation 7.11 Pointers to Functions

2 2 Objectives In this chapter, you will learn: To be able to use pointers. To be able to use pointers to pass arguments to functions using call by reference. To understand the close relationships among pointers, arrays and strings. To understand the use of pointers to functions. To be able to define and use arrays of strings.

3 Introduction Pointers Powerful, but difficult to master Simulate call-by-reference Close relationship with arrays and strings Pointer Variables ( 指標變數 ) Pointer variables contain memory addresses as their values Normal variables contain a specific value (direct reference), e.g., a = 7; a 3 7 Pointer contains the address of a normal variable that has a specific value (indirect reference) Indirection referencing a pointer value aptr a 7

4 Pointer Variable - Definitions and Initialization 4 當我們宣告一個變數 a 時, 編譯器就會配置一記憶體空間給它, 每個記憶體空間都有編號, 這就是記憶體位址 (address) 在 C 語言中, 指標 ( 指標變數 ) 是用來儲存變數位址的一種特殊變數, 如果指標 aptr 存放了變數 a 的位址我們稱 指標 aptr 指向變數 a (aptr points to a) 因為指標變數也是變數的一種, 所以它在記憶體中也有屬於它的位址, 如右圖所示 :

5 Pointer Variable - Definitions and Initialization Pointer Definitions * used with pointer variables ( 宣告時在名稱前加 * ) int *aptr; This means "aptr is a pointer which points to an integer." Defines a pointer to an int (pointer of type int * ) Multiple pointers require using a * before each variable definition ( 每一個指標變數前都必須加 * ) int *myptr1, *myptr2; Pointers can also be defined to point to objects of any other data type. 注意宣告時指標變數之前的資料型態是代表指標所指向的變數之型態 指標本身則儲存了所指向變數的地址 Initialize pointers to 0, NULL, or an address 0 or NULL points to nothing (NULL preferred) 5

6 6 Pointer Operators & (Address Operator 取址運算子 ) Returns address of operand (which can be either a regular or a pointer variable) int y = 5; int *yptr; yptr = &y; // yptr gets address of y Means yptr points to y ( 指標變數 yptr 指向 y, 也就是 yptr 儲存的是 y 的地址 ) 可在宣告時便將它指向某個變數 int y = 5; int *yptr = &y;

7 7.3 Pointer Operators 7 * (Indirection/Dereferencing Operator 依址取值運算子 ) Returns a synonym/alias of what its operand (which is a pointer) points to 當 yptr 為指標變數時,yPtr 為 y 在記憶體中的位址, 而 *yptr 則為存放在該位址之值 ( 即 y 值 ) *yptr returns the value of y (because yptr points to y) * can be used for assignment Returns alias to an object *yptr = 7; // it also changes y to 7 // Dereferenced pointer (operand of *) must be an lvalue (no constants) * and & are inverses & 是取記憶體位置,* 則是取某記憶體位置所存放的值, 所以 : They cancel each other out

8 Using the & And * Operators 1 /* Fig. 7.4: fig07_04.c 2 Using the & and * operators */ 3 #include <stdio.h> 4 5 int main() 6 { 7 int a; /* a is an integer */ 8 int *aptr; /* aptr is a pointer to an integer */ 9 10 a = 7; 11 aptr = &a; /* aptr set to address of a */ printf( "The address of a is %p" 14 "\nthe value of aptr is %p", &a, aptr ); printf( "\n\nthe value of a is %d" 17 "\nthe value of *aptr is %d", a, *aptr ); printf( "\n\nshowing that * and & are complements of " 20 "each other\n&*aptr = %p" 21 "\n*&aptr = %p\n", &*aptr, *&aptr ); return 0; /* indicates successful termination */ Copyright } /* end by main Deitel*/ fig07_04.c 若在宣告時同時定義則用 int a = 7; int *aptr = &a; The address of a is the value of aptr. 注意印地址用 %p The * operator returns an alias to what its operand points to. aptr points to a, so *aptr returns a. Notice how * and & are inverses 8

9 The address of a is 0012FF7C The value of aptr is 0012FF7C 9 The value of a is 7 The value of *aptr is 7 Showing that * and & are complements of each other. &*aptr = 0012FF7C *&aptr = 0012FF7C Program Output

10 Pointer Operators 10

11 指標練習 11 /* 指標的操作練習 testpointer.c */ #include <stdio.h> int main() { int a = 5, b = 10; int *ptr1, *ptr2; ptr1 = &a; /* 將 ptr1 設為 a 的位址 */ ptr2 = &b; /* 將 ptr2 設為 b 的位址 */ *ptr1 = 7; /* 將 ptr1 指向的內容設為 7 */ *ptr2 = 32; /* 將 ptr2 指向的內容設為 32 */ a = 17; /* 設定 a 為 17 */ ptr1 = ptr2; /* 設定 ptr1=ptr2 */ *ptr1 = 9; /* 將 ptr1 指向的內容設為 9 */ ptr1 = &a; /* 將 ptr1 設為 a 的位址 */ a = 64; /* 設定 a 為 64 */ *ptr2 = *ptr1 + 5; /* 將 ptr2 指向的內容設為 *ptr1+5*/ ptr2 = &a; /* 將 ptr2 設為 a 的位址 */ printf("a=%2d, b=%2d, *ptr1=%2d, *ptr2=%2d\n",a,b,*ptr1,*ptr2); printf("ptr1=%p, ptr2=%p\n",ptr1,ptr2); } return 0;

12 指標練習 12

13 13 指標練習 程式碼 a b ptr *ptr 1 int a = 12, b = 7; int *ptr; ptr = &a; 12 7 FF7C 12 4 *ptr = 19; 19 7 FF7C 19 5 ptr = &b; 19 7 FF b = FF *ptr = 12; FF a = 17; FF ptr = &a; FF7C a = b; FF7C *ptr = 63; FF7C 63

14 Call by Value - Example 14 /* 函數的傳值機制借自 C 語言教學手冊 */ #include <stdio.h> void add10(int,int); /* add10() 的原型 */ int main() { int a = 3, b = 5; /* 宣告區域變數 a 與 b */ printf ( " 呼叫函數 add10() 之前 : " ); printf ( "a = %2d, b = %2d\n", a, b ); /* 印出 a b 的值 */ add10(a,b); printf ( " 呼叫函數 add10() 之後 : " ); printf ( "a = %2d, b = %2d\n", a, b ); /* 印出 a b 的值 */ return 0; 呼叫函數 add10() 之前 : a = 3, b = 5 } 函數 add10 中 : a = 13, b = 15 呼叫函數 add10() 之後 : a = 3, b = 5 void add10(int a,int b) { a = a + 10; /* 將變數 a 的值加 10 之後, 設回給 a */ b = b + 10; /* 將變數 b 的值加 10 之後, 設回給 b */ } printf ( " 函數 add10 中 : " ); printf ( "a = %2d, b = %2d\n", a, b ); /* 印出 a b 的值 */

15 Call by Address - Example 15 /* 函數的傳值機制借自 C 語言教學手冊 */ #include <stdio.h> void add10(int *,int *); /* add10() 的原型 */ int main() { int a = 3, b = 5; /* 宣告區域變數 a 與 b */ printf ( " 呼叫函數 add10() 之前 : " ); printf ( "a = %2d, b = %2d\n", a, b ); /* 印出 a b 的值 */ add10(&a,&b); printf ( " 呼叫函數 add10() 之後 : " ); printf ( "a = %2d, b = %2d\n", a, b ); /* 印出 a b 的值 */ } return 0; void add10(int *a,int *b) { *a = *a + 10; *b = *b + 10; 呼叫函數 add10() 之前 : a = 3, b = 5 函數 add10 中 : *a = 13, *b = 15 呼叫函數 add10() 之後 : a = 13, b = 15 } printf ( " 函數 add10 中 : " ); printf ( "*a = %2d, *b = %2d\n ", *a, *b ); /* 印出 *a *b 的值 */

16 Calling Functions by Reference 16 Call by Reference with Pointer Arguments 指標可以在函數間傳遞, 也可從函數傳回指標 呼叫函數時在函數引數 (argument ) 前加 & 即可將該變數的位址傳到函數中 在函數中接收的引數前加 * ( 即宣告為指標函數 ), 就可接受該變數在記憶體位址中之值 ; 在函數中如果該指標函數所代表的值改變時, 表示它在記憶體位址的值也改變了, 這時該值就可在函數間傳遞 在前一章已經提過, 如果引數為陣列的話, 就不需要加 & ; 因為陣列名稱本身就是指標了 * Operator 宣告 number 是個指標變數, 並接收記憶體地址 Used as alias/nickname for variable inside of function void double( int *number ) { *number = 2 * ( *number ); } *number used as nickname for the variable passed *number 就是該位址所存的值

17 Cube a Variable using Call-by-Value 17 1 /* Fig. 7.6: fig07_06.c 2 Cube a variable using call-by-value */ 3 #include <stdio.h> 4 5 int cubebyvalue( int n ); /* prototype */ 6 7 int main() 8 { 9 int number = 5; /* initialize number */ printf( "The original value of number is %d", number ); /* pass number by value to cubebyvalue */ 14 number = cubebyvalue( number ); printf( "\nthe new value of number is %d\n", number ); return 0; /* indicates successful termination */ } /* end main */ /* calculate and return cube of integer argument */ 23 int cubebyvalue( int n ) 24 { 25 return n * n * n; /* cube local variable n and return result */ Copyright } /* end by function Deitel cubebyvalue */ fig07_06.c 如果改成 number1 = cubebyvalue( number ); 時, 主程式中 number 會改變嗎? NO!

18 The original value of number is 5 The new value of number is Program Output 由此例可知 C 語言中的函數若用 call-byvalue 傳值時, 一次只能傳遞一個變數的值, 相當不方便!

19 1 /* Fig. 7.7: fig07_07.c 2 Cube a variable using call-by-reference with a pointer argument */ 3 4 #include <stdio.h> 5 6 void cubebyreference( int *nptr ); /* prototype */ 7 8 int main() 9 { 10 int number = 5; /* initialize number */ printf( "The original value of number is %d", number ); /* pass address of number to cubebyreference */ 15 cubebyreference( &number ); printf( "\nthe new value of number is %d\n", number ); return 0; /* indicates successful termination */ } /* end main */ /* calculate cube of *nptr; modifies variable number in main */ 24 void cubebyreference( int *nptr ) 25 { 26 *nptr = *nptr * *nptr * *nptr; /* cube *nptr */ 27 } /* end function cubebyreference */ Notice that the function prototype takes a pointer to an integer. fig07_07.c 在此把 number 這個變數的記憶體位址傳到函數 cubebyreference 中, 函數接收的引數必須為 pointer (an address of a variable) 19 因此在此處宣告 nptr 為 pointer ( int *nptr ) 來接收該位址的值, 在函數中就用 *nptr 進行計算 計算完後, 該記億位址的值已經更改了, 因為該位址是主程式中 number 的位址, 所以主程式中 number 的值也更改了

20 The original value of number is 5 The new value of number is 由此例可知 C 語言中的函數若用 call-byreference 傳值時, 可以同時傳遞數個變數的值 Program Output

21 21

22 22

23 23

24 24

25 25 const Qualifier Variable cannot be changed ( 變數的值不能再改變, 即成為常數 ) Use const if function does not need to change a variable Attempting to change a const variable produces an error

26 Type Qualifier - const 1 /* Fig. 6.14: fig06_14.c 2 Demonstrating the const type qualifier with arrays */ 3 #include <stdio.h> 4 5 void trytomodifyarray( const int b[] ); /* function prototype */ 6 7 /* function main begins program execution */ 8 int main() 9 { 10 int a[] = { 10, 20, 30 }; /* initialize a */ trytomodifyarray( a ); printf("%d %d %d\n", a[ 0 ], a[ 1 ], a[ 2 ] ); return 0; /* indicates successful termination */ } /* end main */ 19 當宣告變數或陣列時使用 const 這個修飾詞後, 該變數或陣列就宣告成為常數或常數陣列, 它們的內容在程式執行時就不容更改! 當主程式呼叫函式時, 如果函式的引數 (arguments) 是利用陣列傳遞時, 只要在函式中陣列的值改變的話, 主程式中對應的陣列值也會跟著改變 如果要避免主程式的陣列值改變, 這時在函式中可宣告該陣列為常數陣列

27 20 /* in function trytomodifyarray, array b is const, so it cannot be 21 used to modify the original array a in main. */ 22 void trytomodifyarray( const int b[] ) 23 { 24 b[ 0 ] /= 2; /* error */ 25 b[ 1 ] /= 2; /* error */ 26 b[ 2 ] /= 2; /* error */ 27 } /* end function trytomodifyarray */ Compiling... FIG06_14.C fig06_14.c(24) : error C2166: l-value specifies const object fig06_14.c(25) : error C2166: l-value specifies const object fig06_14.c(26) : error C2166: l-value specifies const object 在本函數中, b 已經宣告型態為 const int 的常數型整數陣列, 但在程式中又試圖改變 b 的內容, 因此產生語法錯誤!

28 28 Using the const Qualifier with Pointers A const pointer points to a constant memory location ( 所指地址不能再改變!), which must be initialized when defined ( 在宣告時就必須給值, 也就是某個變數的地址 ) int *const myptr = &x; Read from right to left: "myptr is a constant pointer which points to an integer." Type int *const constant pointer to an int 此處 myptr 為 const pointer, 所以 myptr ( 所指向的地址 ) 不能改變! 故若程式再出現 myptr = &y 時, 在編譯時就會出現錯誤 const int *myptr = &x; "myptr is a regular pointer which points to a constant integer." 此處 *myptr ( 所指向的數值 ) 不能改變, 但 myptr 為一般 pointer 所以 x 的值不能經由 pointer 改變, *myptr = 7 在編譯時就會出現錯誤 但 x 值可改成另外的值, 如 x = x+10; const int *const myptr = &x; myptr is a constant pointer which points to a constant integer." 此處 myptr 與 *myptr 都不能改變! x can be changed, but not *myptr 所以在程式中若寫 x = 7; 時,*myPtr 也跟著變為 7 ; 但不可寫成 *myptr = 7;

29 Converting Lowercase Letters to Uppercase Letters Using a Non-constant pointer to Non-constant Data 29 1 /* Fig. 7.10: fig07_10.c 2 Converting lowercase letters to uppercase letters 3 using a non-constant pointer to non-constant data */ 4 5 #include <stdio.h> 6 #include <ctype.h> 7 8 void converttouppercase( char *sptr ); /* prototype */ 9 10 int main() 11 { 12 char string[] = "characters and $32.98"; /* initialize char array */ printf( "The string before conversion is: %s", string ); 15 converttouppercase( string ); 16 printf( "\nthe string after conversion is: %s\n", string ); return 0; /* indicates successful termination */ } /* end main */ 21 fig07_10.c (Part 1 of 2) 本程式是把字串中小寫字元改成大寫字元, 程式中會用到兩個與字元相關的內建函數 :islower, toupper 故需要加 #include <ctype.h> 記得 string 是字元陣列, 所以作為呼叫函數的引數時不需要加 &, 就已經屬於傳址呼叫! #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include <ctype.h>

30 22 /* convert string to uppercase letters */ 23 void converttouppercase( char *sptr ) 24 { 25 while ( *sptr!= '\0' ) { /* current character is not '\0' */ if ( islower( *sptr ) ) { /* if character is lowercase, */ 28 *sptr = toupper( *sptr ); /* convert to uppercase */ 29 } /* end if */ sptr; /* move sptr to the next character */ 32 } /* end while */ } /* end function converttouppercase */ ++sptr: 更改到下一個字元地址 30 此處有兩個處理字元的函數 :( 需要 #include <ctype.h> ) islower toupper 當本函數接受呼叫時, 傳進來的引數是主程式中 string 陣列第一個元素的地址, 所以在本函數的引數為 宣告 sptr 為字元型態的指標變數, 亦即 char *sptr ; 此時, sptr 拿到的是主程式中 string 陣列第一個元素的地址, 而程式內 *sptr 就是該地址所存的字元 ( 也就是 c h a 等 ) The string before conversion is: characters and $32.98 The string after conversion is: CHARACTERS AND $32.98

31 Printing a String One Character at a Time Using a Non-Constant Pointer to a Constant Data 1 /* Fig. 7.11: fig07_11.c 2 Printing a string one character at a time using 3 a non-constant pointer to constant data */ 4 5 #include <stdio.h> 6 7 void printcharacters( const char *sptr ); 8 9 int main() 10 { 11 /* initialize char array */ 12 char string[] = "print characters of a string"; printf( "The string is:\n" ); 15 printcharacters( string ); 16 printf( "\n" ); return 0; /* indicates successful termination */ } /* end main */ fig07_11.c (Part 1 of 2)

32 22 /* sptr cannot modify the character to which it points, 23 i.e., sptr is a "read-only" pointer */ 24 void printcharacters( const char *sptr ) 25 { 26 /* loop through entire string */ 27 for ( ; *sptr!= '\0'; sptr++ ) { /* no initialization */ 28 printf( "%c", *sptr ); 29 } /* end for */ } /* end function printcharacters */ 32 在此函數中已宣告 sptr 為一般指標變數, 指向到一個 const char, 顯然 *sptr 不可以改變! 也就是在 sptr 地址的字元 (*sptr) 不可以改變 fig07_11.c (Part 2 of 2) 如果程式第一行改成 void printcharacters( char *const sptr) 會產生什麼結果? The string is: print characters of a string Program Output

33 1 /* Fig. 7.12: fig07_12.c 2 Attempting to modify data through a 3 non-constant pointer to constant data. */ 4 #include <stdio.h> 5 6 void f( const int *xptr ); /* prototype */ 7 8 int main() 9 { 10 int y=50; /* define y */ f( &y ); /* f attempts illegal modification */ return 0; /* indicates successful termination */ } /* end main */ /* xptr cannot be used to modify the 19 value of the variable to which it points */ 20 void f( const int *xptr ) 21 { Attempting to Modify Data Through a Non-Constant Pointer to Constant Data 22 *xptr = 100; /* error: cannot modify a const object */ 23 } /* end function f */ fig07_12.c 在此函數中已宣告 xptr 為一般指標變數, 指向到一個 const int, 因此 *xptr 不可以改變! 故在程式中 *xptr = 100 很明顯是錯誤的! 33

34 Compiling... FIG07_12.c d:\books\2003\chtp4\examples\ch07\fig07_12.c(22) : error C2166: l-value specifies const object Error executing cl.exe. FIG07_12.exe - 1 error(s), 0 warning(s) Program Output 34

35 1 /* Fig. 7.13: fig07_13.c 2 Attempting to modify a constant pointer to non-constant data */ 3 #include <stdio.h> 4 5 int main() 6 { 7 int x; /* define x */ 8 int y; /* define y */ 9 10 /* ptr is a constant pointer to an integer that can be modified 11 through ptr, but ptr always points to the same memory location */ 12 int *const ptr = &x; *ptr = 7; /* allowed: *ptr is not const */ 15 ptr = &y; /* error: ptr is const; cannot assign new address */ return 0; /* indicates successful termination */ } /* end main */ 宣告 "ptr is a constant pointer which points to a integer." Changing *ptr is allowed x doesn't need to be a constant. Changing ptr is an error ptr is a constant pointer. Compiling... FIG07_13.c D:\books\2003\chtp4\Examples\ch07\FIG07_13.c(15) : error C2166: l-value specifies const object Error executing cl.exe. fig07_13.c Program Output 35 FIG07_13.exe - 1 error(s), 0 warning(s) Attempting to Modify a Constant Pointer to Nonconstant Data

36 1 /* Fig. 7.14: fig07_14.c 2 Attempting to modify a constant pointer to constant data. */ 3 #include <stdio.h> 4 5 int main() 6 { 7 int x = 5; /* initialize x */ 8 int y; /* define y */ 9 10 /* ptr is a constant pointer to a constant integer. ptr always 11 points to the same location; the integer at that location 12 cannot be modified */ 13 const int *const ptr = &x; printf( "%d\n", *ptr ); *ptr = 7; /* error: *ptr is const; cannot assign new value */ 18 ptr = &y; /* error: ptr is const; cannot assign new address */ return 0; /* indicates successful termination */ 21 Attempting to Modify a Constant Pointer to Constant Data 22 } /* end main */ fig07_14.c 宣告 "ptr is a constant pointer which points to a constant integer." Changing either *ptr or ptr is not allowed. 36

37 Compiling... FIG07_14.c D:\books\2003\chtp4\Examples\ch07\FIG07_14.c(17) : error C2166: l-value specifies const object D:\books\2003\chtp4\Examples\ch07\FIG07_14.c(18) : error C2166: l-value specifies const object Error executing cl.exe. FIG07_12.exe - 2 error(s), 0 warning(s) Program Output 37

38 Questions 38 #include <stdio.h> int main() { int x = 5; /* initialize x */ } int *const ptr = &x; printf( "%d %p\n", *ptr, ptr ); *ptr = 7; return 0; Linking... fig07_14.exe - 0 error(s), 0 warning(s)

39 Questions 39 #include <stdio.h> int main() { int x = 5, y ; int *const ptr = &x; printf( "%d %p\n", *ptr, ptr ); *ptr = 7; ptr = &y; return 0; } Compiling... fig07_14.c m:\fig07_14.c(12) : error C2166: l-value specifies const object Error executing cl.exe. fig07_14.exe - 1 error(s), 0 warning(s)

40 Questions 40 #include <stdio.h> int main() { int x = 5, y ; const int *const ptr = &x; printf( "%d %p\n", *ptr, ptr ); *ptr = 7; ptr = &y; return 0; } fig07_14.c m:\fig07_14.c(11) : error C2166: l-value specifies const object m:\fig07_14.c(12) : error C2166: l-value specifies const object Error executing cl.exe.

41 Questions 41 #include <stdio.h> int main() { int x = 5 ; } const int *const ptr = &x; x = 7; printf( "%d %p\n", *ptr, ptr ); return 0; Linking... fig07_14.exe - 0 error(s), 0 warning(s) FF7C Press any key to continue

42 42 Bubble Sort Using Call-by-reference Implement Bubble Sort Using Pointers Swap two elements swap function must receive address (using &) of array elements Array elements have call-by-value default Using pointers and the * operator, swap can switch array elements Pseudocode Initialize array print data in original order Call function bubblesort print sorted array Define bubblesort

43 Function bubblesort with Call-by-Value - Review void bubblesort( int a[] ) 136 { 137 int pass; /* counter */ 138 int j; /* counter */ 139 int hold; /* temporary location used to swap elements */ /* loop to control number of passes */ 142 for ( pass = 1; pass < SIZE; pass++ ) { /* loop to control number of comparisons per pass */ 145 for ( j = 0; j < SIZE - 1; j++ ) { /* swap elements if out of order */ 148 if ( a[ j ] > a[ j + 1 ] ) { 149 hold = a[ j ]; 150 a[ j ] = a[ j + 1 ]; 151 a[ j + 1 ] = hold; 152 } /* end if */ } /* end inner for */ } /* end outer for */ } /* end function bubblesort */ } /* end inner for */

44 1 /* Fig. 7.15: fig07_15.c 2 This program puts values into an array, sorts the values into 3 ascending order, and prints the resulting array. */ 4 #include <stdio.h> 5 #define SIZE void bubblesort( int *array, const int size ); /* prototype */ 8 9 int main() 10 { 11 /* initialize array a */ 12 int a[ SIZE ] = { 2, 6, 4, 8, 10, 12, 89, 68, 45, 37 }; int i; /* counter */ printf( "Data items in original order\n" ); /* loop through array a */ 19 for ( i = 0; i < SIZE; i++ ) { 20 printf( "%4d", a[ i ] ); 21 } /* end for */ bubblesort( a, SIZE ); /* sort the array */ Bubble Sort with Call-by-Reference 25 printf( "\ndata items in ascending order\n" ); Bubblesort gets passed the address of array elements (pointers). The name of an array is a pointer. 44 fig07_15.c (Part 1 of 3)

45 45 27 /* loop through array a */ 28 for ( i = 0; i < SIZE; i++ ) { 29 printf( "%4d", a[ i ] ); 30 } /* end for */ printf( "\n" ); return 0; /* indicates successful termination */ } /* end main */ fig07_15.c (Part 2 of 3)

46 46 38 /* sort an array of integers using bubble sort algorithm */ 39 void bubblesort( int *array, const int size ) 40 { 41 void swap( int *element1ptr, int *element2ptr ); /* prototype */ 42 int pass; /* pass counter */ 43 int j; /* comparison counter */ /* loop to control passes */ 46 for ( pass = 0; pass < size - 1; pass++ ) { /* loop to control comparisons during each pass */ 49 for ( j = 0; j < size - 1; j++ ) { /* swap adjacent elements if they are out of order */ 52 if ( array[ j ] > array[ j + 1 ] ) { 53 swap( &array[ j ], &array[ j + 1 ] ); 54 } /* end if */ } /* end inner for */ } /* end outer for */ } /* end function bubblesort */ 注意在這裡我們並未定義 array 為陣列 ( 事實上 array 為指標變數 ), 但為什麼能夠用 array[j] 與 array[j+1]? 這種利用指標變數找陣列元素的方法將在後面 (Sec. 7.9) 會詳加說明 簡單的說, 就是陣列的名稱就是陣列的地址, 指標變數所存的值也是地址, 因此當 array 存的是陣列 a 的地址時,array[3] 和 a[3] 是同樣的意思

47 /* swap values at memory locations to which element1ptr and 63 element2ptr point */ 64 void swap( int *element1ptr, int *element2ptr ) 65 { 66 int hold = *element1ptr; 67 *element1ptr = *element2ptr; 68 *element2ptr = hold; 69 } /* end function swap */ fig07_15.c (Part 3 of 3) 傳址呼叫後, 將函數的引數 *element1ptr 與 *element2ptr 之值交換 ;same as hold = a[ j ]; a[ j ] = a[ j + 1 ]; a[ j + 1 ] = hold; Data items in original order Data items in ascending order Program Output

48 Function sizeof 48 sizeof Returns size of operand in bytes 1 byte = 8 bits For arrays: (size of 1 element) (number of elements) 用法 :sizeof( 變數型態 ), 或 sizeof 變數名稱, 或 sizeof( 變數名稱 ) if sizeof( int ) equals 4 bytes, then int myarray[ 10 ]; printf( "%d", sizeof( myarray ) ); will print 40 sizeof can be used with Variable names Type name Constant values

49 49 Typical Size and Range of Data Types For Borland Compiler Data Type Size Bytes Min Value Max Value char short int int long int float e e+38 double e e+308 long double e e+4932 For Visual C++ and C Compiler Data Type Size Bytes Min Value Max Value char short int int long int float e e+38 double e e+308 long double e e+308

50 /* SIZEOF.C--Program to tell the size of the C variable */ /* type in bytes */ 50 #include <stdio.h> main() { printf( "\na char is %d bytes", sizeof( char )); printf( "\nan int is %d bytes", sizeof( int )); printf( "\na short is %d bytes", sizeof( short )); printf( "\na long is %d bytes", sizeof( long )); printf( "\nan unsigned char is %d bytes", sizeof( unsigned char )); printf( "\nan unsigned int is %d bytes", sizeof( unsigned int )); printf( "\nan unsigned short is %d bytes", sizeof( unsigned short )); printf( "\nan unsigned long is %d bytes", sizeof( unsigned long )); printf( "\na float is %d bytes", sizeof( float )); printf( "\na double is %d bytes", sizeof( double )); printf( "\na long double is %d bytes\n", sizeof( long double )); return 0; } A char is 1 bytes An int is 4 bytes A short is 2 bytes A long is 4 bytes An unsigned char is 1 bytes An unsigned int is 4 bytes An unsigned short is 2 bytes An unsigned long is 4 bytes A float is 4 bytes A double is 8 bytes A long double is 8 bytes - for Visual C++ Compiler A long double is 10 bytes - for Borland Compiler

51 1 /* Fig. 7.16: fig07_16.c 2 Sizeof operator when used on an array name 3 returns the number of bytes in the array. */ 4 #include <stdio.h> 5 6 size_t getsize( float *ptr ); /* prototype */ 7 8 int main() 9 { 10 float array[ 20 ]; /* create array */ printf( "The number of bytes in the array is %d" 13 "\nthe number of bytes returned by getsize is %d\n", 14 sizeof( array ), getsize( array ) ); return 0; /* indicates successful termination */ } /* end main */ /* return size of ptr */ 21 size_t getsize( float *ptr ) 22 { 23 return sizeof( ptr ); 24 Operator sizeof When Applied to an Array name Returns the Number of Bytes in the Array 25 } /* end function getsize */ fig07_16.c The number of bytes in the array is 80 The number of bytes returned by getsize is 4 51 此處使用 size_t 當成 sizeof 函數取得的值的型態 ;size_t 在 C 語言中內定為無號整數 ( unsigned or unsigned long ) 型態, 在此也可把 size_t 改成 int

52 1 /* Fig. 7.17: fig07_17.c 2 Demonstrating the sizeof operator */ 3 #include <stdio.h> 4 5 int main() 6 { 7 char c; /* define c */ 8 short s; /* define s */ 9 int i; /* define i */ 10 long l; /* define l */ 11 float f; /* define f */ 12 double d; /* define d */ 13 long double ld; /* define ld */ 14 int array[ 20 ]; /* initialize array */ 15 int *ptr = array; /* create pointer to array */ printf( " sizeof c = %d\tsizeof(char) = %d" 18 "\n sizeof s = %d\tsizeof(short) = %d" 19 "\n sizeof i = %d\tsizeof(int) = %d" 20 "\n sizeof l = %d\tsizeof(long) = %d" 21 "\n sizeof f = %d\tsizeof(float) = %d" 22 "\n sizeof d = %d\tsizeof(double) = %d" 23 "\n sizeof ld = %d\tsizeof(long double) = %d" 24 "\n sizeof array = %d" 25 "\n sizeof ptr = %d\n", 52 fig07_17.c (Part 1 of 2)

53 26 sizeof c, sizeof( char ), sizeof s, 27 sizeof( short ), sizeof i, sizeof( int ), 28 sizeof l, sizeof( long ), sizeof f, 29 sizeof( float ), sizeof d, sizeof( double ), 30 sizeof ld, sizeof( long double ), 31 sizeof array, sizeof ptr ); return 0; /* indicates successful termination */ } /* end main */ sizeof c = 1 sizeof(char) = 1 sizeof s = 2 sizeof(short) = 2 sizeof i = 4 sizeof(int) = 4 sizeof l = 4 sizeof(long) = 4 sizeof f = 4 sizeof(float) = 4 sizeof d = 8 sizeof(double) = 8 sizeof ld = 8 sizeof(long double) = 8 sizeof array = 80 sizeof ptr = 4 fig07_17.c (Part 2 of 2) Program Output 53

54 54 Pointer Expressions and Pointer Arithmetic Example: 5-element int array on machine with 4 byte ints int v[ 5 ]; int *vptr = &v (or v or &v[0]); vptr points to first element v[ 0 ], Say at location 3000 (vptr = 3000) vptr += 2; sets vptr to 3008( 即 *4; 並非 3002!). In other words, vptr points to v[ 2 ] (incremented by 2), but the machine has 4 byte ints, so it points to address 3008

55 Pointer Expressions and Pointer Arithmetic 55

56 56 Pointer Expressions and Pointer Arithmetic Arithmetic operations can be performed on pointers (here, vptr) vptr = v; or vptr = &v[0]; Increment/decrement pointer (++ or --) vptr++ Add an integer to a pointer( + or +=, - or -=) vptr += 2 Pointers may be subtracted from each other vptr2 vptr ( 如果 vptr 為 3000,vPtr2 為 3008, 則 vptr2 vptr 為 2, 不是 8) Operations meaningless unless performed on pointer which points to an array ( 如果 vptr 不是指向陣列時, 以上的運算就沒有意義 ) Recall that 陣列的名稱即代表該陣列的開始的地址 ;i.e., array, &array[0], 與 &array 三者都是 array 這個陣列在記憶體中開始的位址

57 57 Pointer Expressions and Pointer Arithmetic Increment/decrement pointer if vptr = 3016, which points to v[4], then vptr -= 4 would set vptr back to vptr; vptr++; --vptr; vptr--; Subtracting pointers Returns number of elements from one to the other. If vptr2 = &v[ 2 ]; vptr = &v[ 0 ]; vptr2 - vptr would produce 2 Pointer comparison ( <, ==, > ) Meaningful for the pointers point to elements of the same array.

58 58 Pointer Expressions and Pointer Arithmetic Pointers of the same type can be assigned to each other If not the same type, a cast operator, e.g., (float), (int), etc., must be used Exception: pointer to void (type void *) void *bptr; Generic pointer, represents any type No casting needed to convert a pointer to void pointer void pointers cannot be dereferenced ( 無法依址找值, 也就是說, 程式中若有 *bptr 將無法執行 ) since a pointer to void simply contains a memory location for an unknown data type.

59 59 Relationship Between Pointers and Arrays Arrays and pointers are closely related Array name like a constant pointer Pointers can do array subscripting operations Define an array b[ 5 ] and a pointer bptr To set them equal to one another, we can use: int b[5]; int *bptr; bptr = b; The array name, b, is actually the address of first element, b[0], of the array b. bptr = &b[ 0 ] ; Explicitly assigns bptr to address of first element of b

60 60 Relationship Between Pointers and Arrays Element b[ 3 ] 1. Can be accessed by *( bptr + 3 ) 在此 bptr 即為 b 這個陣列第一個元素 b[0] 的地址 ; bptr + 3 即為 b[3] 的地址 Where 3 is the offset. Called pointer/offset notation &b[3] b + 3 與 bptr + 3 同義, 都是 b[3] 的 地址 2. Can also be accessed by bptr[ 3 ] Called pointer/subscript notation bptr[ 3 ] 是 bptr+3 這個地址所存的值 bptr[ 3 ] same as b[ 3 ] 3. Can finally be accessed by performing pointer arithmetic on the array itself *( b + 3 ) Question: bptr += 3 與 b += 3 是否一樣? Ans: NO! Remark: bptr 是 pointer, 可以改變指向的位址, 但 b 是陣列, 也是第一個元素 b[0] 的地址, 因此 b 可視為 a constant pointer, 不能改變 b 的值

61 sing Subscripting and Pointer Notations with Arrays 61 1 /* Fig. 7.20: fig07_20.cpp 2 Using subscripting and pointer notations with arrays */ 3 4 #include <stdio.h> 5 6 int main() 7 { 8 int b[] = { 10, 20, 30, 40 }; /* initialize array b */ 9 int *bptr = b; /* set bptr to point to array b */ 10 int i; /* counter */ 11 int offset; /* counter */ /* output array b using array subscript notation */ 14 printf( "Array b printed with:\narray subscript notation\n" ); /* loop through array b */ 17 for ( i = 0; i < 4; i++ ) { 18 printf( "b[ %d ] = %d\n", i, b[ i ] ); 19 } /* end for */ /* output array b using array name and pointer/offset notation */ 22 printf( "\npointer/offset notation where\n" 23 "the pointer is the array name\n" ); 24 b[ 0 ] = 10 b[ 1 ] = 20 b[ 2 ] = 30 b[ 3 ] = 40 fig07_20.c (Part 1 of 2)

62 25 /* loop through array b */ 26 for ( offset = 0; offset < 4; offset++ ) { 27 printf( "*( b + %d ) = %d\n", offset, *( b + offset ) ); 28 } /* end for */ /* output array b using bptr and array subscript notation */ 31 printf( "\npointer subscript notation\n" ); /* loop through array b */ 34 for ( i = 0; i < 4; i++ ) { 35 printf( "bptr[ %d ] = %d\n", i, bptr[ i ] ); 36 } /* end for */ /* output array b using bptr and pointer/offset notation */ 39 printf( "\npointer/offset notation\n" ); /* loop through array b */ 42 for ( offset = 0; offset < 4; offset++ ) { 43 printf( "*( bptr + %d ) = %d\n", offset, *( bptr + offset ) ); 44 } /* end for */ return 0; /* indicates successful termination */ } /* end main */ *( bptr + 0 ) = 10 *( bptr + 1 ) = 20 *( bptr + 2 ) = 30 *( bptr + 3 ) = 40 bptr[ 0 ] = 10 bptr[ 1 ] = 20 bptr[ 2 ] = 30 bptr[ 3 ] = 40 *( b + 0 ) = 10 *( b + 1 ) = 20 *( b + 2 ) = 30 *( b + 3 ) = fig07_20.c (Part 2 of 2)

63 Array b printed with: Array subscript notation b[ 0 ] = 10 b[ 1 ] = 20 b[ 2 ] = 30 b[ 3 ] = 40 Pointer/offset notation where the pointer is the array name *( b + 0 ) = 10 *( b + 1 ) = 20 *( b + 2 ) = 30 *( b + 3 ) = 40 Pointer subscript notation bptr[ 0 ] = 10 bptr[ 1 ] = 20 bptr[ 2 ] = 30 bptr[ 3 ] = 40 Pointer/offset notation *( bptr + 0 ) = 10 *( bptr + 1 ) = 20 *( bptr + 2 ) = 30 *( bptr + 3 ) = 40 Program Output 63

64 opying a String Using Array Notation and Pointer Notation 64 1 /* Fig. 7.21: fig07_21.c 2 Copying a string using array notation and pointer notation. */ 3 #include <stdio.h> 4 5 void copy1( char *s1, const char *s2 ); /* prototype */ 6 void copy2( char *s1, const char *s2 ); /* prototype */ 7 8 int main() 9 { 10 char string1[ 10 ]; /* create array string1 */ 11 char *string2 = "Hello"; /* create a pointer to a string */ 12 char string3[ 10 ]; /* create array string3 */ 13 char string4[] = "Good Bye"; /* create a pointer to a string */ copy1( string1, string2 ); 16 printf( "string1 = %s\n", string1 ); copy2( string3, string4 ); 19 printf( "string3 = %s\n", string3 ); return 0; /* indicates successful termination */ } /* end main */ 24 fig07_21.c (Part 1 of 2) 在此 string2 並非陣列, 而是一個指向陣列 "Hello" 的指標 此處 'Hello" 及 string4 各含幾個元素? 在此把 string1 和 Hello 字串陣列的地址傳到函數 copy1 中 此處 string2 就是 Hello 字串陣列的地址

65 25 /* copy s2 to s1 using array notation */ 26 void copy1( char *s1, const char *s2 ) 27 { 28 int i; /* counter */ /* loop through strings */ 31 for ( i = 0; ( s1[ i ] = s2[ i ] )!= '\0'; i++ ) { 32 ; /* do nothing in body */ 33 } /* end for */ } /* end function copy1 */ /* copy s2 to s1 using pointer notation */ 38 void copy2( char *s1, const char *s2 ) 39 { 40 /* loop through strings */ 41 for ( ; ( *s1 = *s2 )!= '\0'; s1++, s2++ ) { 42 ; /* do nothing in body */ 43 } /* end for */ } /* end function copy2 */ string1 = Hello string3 = Good Bye 在此 s1 和 s2 都是指標變數, 分別接收主函數傳來的地址 65 fig07_21.c (Part 2 of 2) 在此把儲存在 s2[i] 的字元複製到 s1[i] 中, 直到字元結束 (\0) 符號出現為止 Program Output

66 Arrays of Pointers 66 An array can contain pointers ( 指標陣列 ) as its elements For example: an array of strings const char *suit[ 4 ] = { "Hearts", "Diamonds", "Clubs", "Spades" }; suit[4] 為一個含四個元素的指標陣列, 個別指向 const char, i.e., the strings pointed by each element pointer cannot be modified (const). Each pointer points to the first character of a string (or an array of char). The strings are not actually stored in the array suit, only pointers to the strings are stored in this array. 黑桃 (Spades) 紅心 (Hearts) 梅花 (Clubs) 方塊 (Diamonds ) suit array has a fixed size (4, in this case), but strings can be of any size

67 67 The Advantage of Pointer Arrays The suits could have been placed into a twodimensional array in which each row would represent one suit, and each column would represent one of the letters of a suit name. Such a data structure would have to have a fixed number of columns per row, and that number would have to be as large as the longest string. Therefore, considerable memory could be wasted when a large number of strings being stored with most strings shorter than the longest string.

68 Case Study: A Card Shuffling and Dealing Simulation Card shuffling program 1. Use two (2) pointer arrays to store strings for suits and faces 2. Use another double-scripted regular array (suit ( 花色 ), face ( 點數 ) ) to represent a full deck of cards The numbers 1-52 go into the array, representing the order in which the cards are dealt

69 Case Study: A Card Shuffling and Dealing Simulation Pseudocode Top level: Shuffle ( 洗牌 ) and deal ( 發牌 ) 52 cards First refinement: Initialize the suit array ( pointer array, *suit[4] ) Initialize the face array ( pointer array, *face[13] ) Initialize the deck array ( regular array, deck[4][13] ) Shuffle the deck Deal 52 cards 69

70 Case Study: A Card Shuffling and Dealing Simulation Second refinement Convert shuffle the deck to For each of the 52 cards Place card number (order) in randomly selected unoccupied slot of deck Convert deal 52 cards to Consider each of the 52 card numbers in sequential order Find card number in deck array and print face and suit of card 70

71 Case Study: A Card Shuffling and Dealing Simulation Third refinement Convert shuffle the deck to Choose slot of deck randomly If the chosen slot of deck has been previously chosen, then choose another slot of deck randomly If not, place card number in chosen slot of deck Convert deal 52 cards sequentially to For each slot of the deck array If slot contains card number Print the face and suit of the card 71

72 1 /* Fig. 7.24: fig07_24.c 2 Card shuffling dealing program */ 3 #include <stdio.h> 4 #include <stdlib.h> 5 #include <time.h> 6 7 /* prototypes */ 8 void shuffle( int wdeck[][ 13 ] ); 9 void deal( const int wdeck[][ 13 ], const char *wface[], 10 const char *wsuit[] ); int main() 13 { 14 /* initialize suit array */ 15 const char *suit[ 4 ] = { "Hearts", "Diamonds", "Clubs", "Spades" }; /* initialize face array */ 18 const char *face[ 13 ] = 19 { "Ace", "Deuce", "Three", "Four", 20 "Five", "Six", "Seven", "Eight", 21 "Nine", "Ten", "Jack", "Queen", "King" }; /* initialize deck array */ 24 int deck[ 4 ][ 13 ] = { 0 }; 25 先將 deck 所有元素設為 0 fig07_24.c (Part 1 of 4) 72

73 73 26 srand( time( 0 ) ); /* seed random-number generator */ shuffle( deck ); 29 deal( deck, face, suit ); return 0; /* indicates successful termination */ } /* end main */ 34 呼叫洗牌 shuffle 與發牌 deal 函數 fig07_24.c (Part 2 of 4)

74 35 /* shuffle cards in deck */ 36 void shuffle( int wdeck[][ 13 ] ) 37 { 38 int row; /* row number */ 39 int column; /* column number */ 40 int card; /* counter */ /* for each of the 52 cards, choose slot of deck randomly */ 43 for ( card = 1; card <= 52; card++ ) { /* choose new random location until unoccupied slot found */ 46 do { 47 row = rand() % 4; 48 column = rand() % 13; 49 } while( wdeck[ row ][ column ]!= 0 ); /* end do...while */ 50 Shuffle 洗牌程式 51 /* place card number in chosen slot of deck */ 52 wdeck[ row ][ column ] = card; 53 } /* end for */ } /* end function shuffle */ fig07_24.c (Part 3 of 4) 主函數中已把 wdeck 陣列的值都設成 0 ; 洗牌的方法就是 : 取 wdeck 陣列中數值是 0 的某一個元素 再依序把 寫入

75 57 /* deal cards in deck */ 58 void deal( const int wdeck[][ 13 ], const char *wface[], 59 const char *wsuit[] ) 60 { 61 int card; /* card counter */ 62 int row; /* row counter */ 63 int column; /* column counter */ /* deal each of the 52 cards */ 66 for ( card = 1; card <= 52; card++ ) { /* loop through rows of wdeck */ 69 for ( row = 0; row <= 3; row++ ) { /* loop through columns of wdeck for current row */ 72 for ( column = 0; column <= 12; column++ ) { /* if slot contains current card, display card */ 75 if ( wdeck[ row ][ column ] == card ) { 76 printf( "%5s of %-8s%c", wface[ column ], wsuit[ row ], 77 card % 2 == 0? '\n' : '\t' ); 78 } /* end if */ } /* end for */ } /* end for */ } /* end for */ 85 Deal ( 發牌 ) 程式 86 Copyright } /* end by function Deitel deal */ 從第 1 張開始, 發到第 52 張牌 ; fig07_24.c (Part 4 of 4) 找第 card 出現在哪裡 ( row? And column? ) ; 並利用 wface 及 wsuit 找出對應的點數及花色 75

76 Nine of Hearts Queen of Spades Queen of Hearts King of Hearts Jack of Diamonds Seven of Hearts Three of Clubs Three of Diamonds Queen of Diamonds Six of Diamonds Ace of Spades Nine of Diamonds Eight of Spades Deuce of Clubs Deuce of Spades Four of Clubs Four of Spades Seven of Diamonds King of Spades Jack of Hearts Jack of Spades Eight of Diamonds Ace of Diamonds Four of Hearts King of Diamonds Three of Hearts Five of Clubs Three of Spades Ace of Clubs Six of Spades Five of Spades King of Clubs Eight of Hearts Four of Diamonds Five of Diamonds Five of Hearts Six of Hearts Queen of Clubs Nine of Clubs Six of Clubs Jack of Clubs Eight of Clubs Seven of Spades Seven of Clubs Ten of Diamonds Ace of Hearts Ten of Clubs Deuce of Diamonds Nine of Spades Deuce of Hearts Ten of Spades Ten of Hearts Program Output 76

77 77 Pointers to Functions Pointer to function 前面已談到, 陣列的名稱是陣列中第一個 ( 編號為 0) 的元素在記憶體中的位置, 相同的, 函數的名稱是記憶體中函數程式碼儲存的開始位置 Similar to how array name is address of first element, function name is starting address of code that defines function 指標也可以指向函數 (function) ; 指向函數時, 就是指向函數程式碼在記憶體中開始的位址 Contains address of function Pointer to function 就像一般的指標變數, 可以 : Passed to functions Returned from functions Stored in arrays Assigned to other function pointers

78 78 Pointers to Functions Example: bubblesort void bubble( int work[], const int size, int (*compare)( int a, int b ) ) Function bubble takes a function pointer: compare bubble calls this helper function which determines ascending or descending sorting The argument in bubblesort for the function pointer: int (*compare)( int a, int b ) tells bubblesort to expect a pointer to a function that takes two ints and returns an int ( 回傳整數 ) 在這裡注意 (*compare) 含括號, 表示 1. 接收一個函數的地址 2. 放到 compare 這個函數指標

79 79 Pointers to Functions Example: bubblesort void bubble( int work[], const int size, int (*compare)( int a, int b ) ) 如果 (*compare) 沒有括號, 則 : int *compare( int a, int b ) Defines a function that receives two integers and returns a pointer to a int, 變成定義一個叫 compare 的函數, 這個函數回傳的是某個整數的地址

80 Multipurpose Sorting Program Using Function Pointers 80 1 /* Fig. 7.26: fig07_26.c 2 Multipurpose sorting program using function pointers */ 3 #include <stdio.h> 4 #define SIZE /* prototypes */ 7 void bubble( int work[], const int size, int (*compare)( int a, int b ) ); 8 int ascending( int a, int b ); 9 int descending( int a, int b ); int main() 12 { 13 int order; /* 1 for ascending order or 2 for descending order */ 14 int counter; /* counter */ /* initialize array a */ 17 int a[ SIZE ] = { 2, 6, 4, 8, 10, 12, 89, 68, 45, 37 }; printf( "Enter 1 to sort in ascending order,\n" 20 "Enter 2 to sort in descending order: " ); 21 scanf( "%d", &order ); printf( "\ndata items in original order\n" ); 24 fig07_26.c (Part 1 of 4) 在這裡, 程式會問排序法是要用遞增或是遞減 ; order = 1 是遞增 order = 2 是遞減

81 25 /* output original array */ 26 for ( counter = 0; counter < SIZE; counter++ ) { 27 printf( "%5d", a[ counter ] ); 28 } /* end for */ /* sort array in ascending order; pass function ascending as an 31 argument to specify ascending sorting order */ 32 if ( order == 1 ) { 33 bubble( a, SIZE, ascending ); 34 printf( "\ndata items in ascending order\n" ); 35 } /* end if */ 36 else { /* pass function descending */ 37 bubble( a, SIZE, descending ); 38 printf( "\ndata items in descending order\n" ); 39 } /* end else */ /* output sorted array */ 42 for ( counter = 0; counter < SIZE; counter++ ) { 43 printf( "%5d", a[ counter ] ); 44 } /* end for */ printf( "\n" ); return 0; /* indicates successful termination */ } /* end main */ fig07_26.c (Part 2 of 4) 如果是遞增的話, 就呼叫 ascending 這個函數, 要不然就呼叫 descending 記得 ascending 及 descending 這兩個函數名稱也是該函數的地址

82 52 /* multipurpose bubble sort; parameter compare is a pointer to 53 the comparison function that determines sorting order */ 54 void bubble( int work[], const int size, int (*compare)( int a, int b ) ) 55 { 82 fig07_26.c (Part 3 of 4) 56 int pass; /* pass counter */ 57 int count; /* comparison counter */ void swap( int *element1ptr, int *element2ptr ); /* prototype */ /* loop to control passes */ 62 for ( pass = 1; pass < size; pass++ ) { 63 既然傳進來的是地址 ( 函數名稱 ), 我們就用指標 (pointer) 來接收 在這裡定義 compare 是一個指標, 指向某個函數 ( 及函數名稱 ) ; 在不同條件下, 就會呼叫不同的函數來執行 64 /* loop to control number of comparisons per pass */ 65 for ( count = 0; count < size - 1; count++ ) { /* if adjacent elements are out of order, swap them */ 68 if ( (*compare)( work[ count ], work[ count + 1 ] ) ) { 69 swap( &work[ count ], &work[ count + 1 ] ); 70 } /* end if */ } /* end for */ } /* end for */ } /* end function bubble */ 77

83 78 /* swap values at memory locations to which element1ptr and 79 element2ptr point */ 80 void swap( int *element1ptr, int *element2ptr ) 81 { 82 int hold; /* temporary holding variable */ hold = *element1ptr; 85 *element1ptr = *element2ptr; 86 *element2ptr = hold; 87 } /* end function swap */ /* determine whether elements are out of order for an ascending 90 order sort */ 91 int ascending( int a, int b ) 92 { 93 return b < a; /* swap if b is less than a */ } /* end function ascending */ /* determine whether elements are out of order for a descending 98 order sort */ 99 int descending( int a, int b ) 100 { 101 return b > a; /* swap if b is greater than a */ } /* end function descending */ fig07_26.c (Part 4 of 4) 當 b < a 是對的話, return 'true', 也就是說 return 1 ( ascending = 1 ) 回去 83

84 Enter 1 to sort in ascending order, Enter 2 to sort in descending order: 1 84 Data items in original order Data items in ascending order Program Output Enter 1 to sort in ascending order, Enter 2 to sort in descending order: 2 Data items in original order Data items in descending order

85 85 Review In this chapter, we have learned: How to use pointers. How to use pointers to pass arguments to functions using call by reference. To understand the close relationships among pointers, arrays and strings. To understand the use of pointers to functions. How to define and use arrays of strings.

86 Exercises Find the error in each of the following program segments. If the error can be corrected, explain how. a) int *number; printf( "%d\n", *number ); ANS: number has not been assigned to point to a location in memory. 86 b) float *realptr; long *integerptr; integerptr = realptr; ANS: A pointer cannot be assigned to a different type, other than void *. c) int * x, y; x = y; ANS: There are two possible solutions. 1) The indirection operator (*) is not distributive and would be required for y, which would result in a valid pointer assignment. 2) y as it is defined is a valid integer variable, and would require the address operator (&) in the pointer assignment statement. d) char s[] = "this is a character array"; int count; for ( ; *s!= '\0'; s++) printf( "%c ", *s ); ANS: s should be defined as char *, a constant pointer cannot be moved.

87 Exercises 87 e) short *numptr, result; void *genericptr = numptr; result = *genericptr + 7; ANS: 由於無法知道儲存在 genericptr 地址的變數型態, 所以 *genericptr 的值無法找出 A void * pointer cannot be dereferenced. f) float x = 19.34; float xptr = &x; printf( "%f\n", xptr ); ANS: xptr is not defined as a pointer so it should be dereferenced as well. g) char *s; printf( "%s\n", s ); ANS: s has not been assigned a value, it does not point to anything.

C++ 程式設計

C++ 程式設計 C C 料, 數, - 列 串 理 列 main 數串列 什 pointer) 數, 數, 數 數 省 不 不, 數 (1) 數, 不 數 * 料 * 數 int *int_ptr; char *ch_ptr; float *float_ptr; double *double_ptr; 數 (2) int i=3; int *ptr; ptr=&i; 1000 1012 ptr 數, 數 1004

More information

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc

Fun Time (1) What happens in memory? 1 i n t i ; 2 s h o r t j ; 3 double k ; 4 char c = a ; 5 i = 3; j = 2; 6 k = i j ; H.-T. Lin (NTU CSIE) Referenc References (Section 5.2) Hsuan-Tien Lin Deptartment of CSIE, NTU OOP Class, March 15-16, 2010 H.-T. Lin (NTU CSIE) References OOP 03/15-16/2010 0 / 22 Fun Time (1) What happens in memory? 1 i n t i ; 2

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 49 [P.51] C/C++ [P.52] [P.53] [P.55] (int) [P.57] (float/double) [P.58] printf scanf [P.59] [P.61] ( / ) [P.62] (char) [P.65] : +-*/% [P.67] : = [P.68] : ,

More information

C/C++ 语言 - 循环

C/C++ 语言 - 循环 C/C++ Table of contents 7. 1. 2. while 3. 4. 5. for 6. 8. (do while) 9. 10. (nested loop) 11. 12. 13. 1 // summing.c: # include int main ( void ) { long num ; long sum = 0L; int status ; printf

More information

Improved Preimage Attacks on AES-like Hash Functions: Applications to Whirlpool and Grøstl

Improved Preimage Attacks on AES-like Hash Functions: Applications to Whirlpool and Grøstl SKLOIS (Pseudo) Preimage Attack on Reduced-Round Grøstl Hash Function and Others Shuang Wu, Dengguo Feng, Wenling Wu, Jian Guo, Le Dong, Jian Zou March 20, 2012 Institute. of Software, Chinese Academy

More information

C/C++语言 - C/C++数据

C/C++语言 - C/C++数据 C/C++ C/C++ Table of contents 1. 2. 3. 4. char 5. 1 C = 5 (F 32). 9 F C 2 1 // fal2cel. c: Convert Fah temperature to Cel temperature 2 # include < stdio.h> 3 int main ( void ) 4 { 5 float fah, cel ;

More information

4. 每 组 学 生 将 写 有 习 语 和 含 义 的 两 组 卡 片 分 别 洗 牌, 将 顺 序 打 乱, 然 后 将 两 组 卡 片 反 面 朝 上 置 于 课 桌 上 5. 学 生 依 次 从 两 组 卡 片 中 各 抽 取 一 张, 展 示 给 小 组 成 员, 并 大 声 朗 读 卡

4. 每 组 学 生 将 写 有 习 语 和 含 义 的 两 组 卡 片 分 别 洗 牌, 将 顺 序 打 乱, 然 后 将 两 组 卡 片 反 面 朝 上 置 于 课 桌 上 5. 学 生 依 次 从 两 组 卡 片 中 各 抽 取 一 张, 展 示 给 小 组 成 员, 并 大 声 朗 读 卡 Tips of the Week 课 堂 上 的 英 语 习 语 教 学 ( 二 ) 2015-04-19 吴 倩 MarriottCHEI 大 家 好! 欢 迎 来 到 Tips of the Week! 这 周 我 想 和 老 师 们 分 享 另 外 两 个 课 堂 上 可 以 开 展 的 英 语 习 语 教 学 活 动 其 中 一 个 活 动 是 一 个 充 满 趣 味 的 游 戏, 另 外

More information

A.doc

A.doc A CopyRight: 2003, Mahler Works C > 1.1 C (5 min) 1.1.1C 1.1.21998 ANSIAmerican National Standards InsituteISO International Standards Organzation 1.1.3C/C++C C 1.1.4 C JAVA PLATFORM C 1.2 (5 min)

More information

Microsoft PowerPoint - Lecture7II.ppt

Microsoft PowerPoint - Lecture7II.ppt Lecture 8II SUDOKU PUZZLE SUDOKU New Play Check 軟體實作與計算實驗 1 4x4 Sudoku row column 3 2 } 4 } block 1 4 軟體實作與計算實驗 2 Sudoku Puzzle Numbers in the puzzle belong {1,2,3,4} Constraints Each column must contain

More information

新・明解C言語入門編『索引』

新・明解C言語入門編『索引』 !... 75!=... 48 "... 234 " "... 9, 84, 240 #define... 118, 213 #include... 148 %... 23 %... 23, 24 %%... 23 %d... 4 %f... 29 %ld... 177 %lf... 31 %lu... 177 %o... 196 %p... 262 %s... 242, 244 %u... 177

More information

C/C++语言 - 分支结构

C/C++语言 - 分支结构 C/C++ Table of contents 1. if 2. if else 3. 4. 5. 6. continue break 7. switch 1 if if i // colddays.c: # include int main ( void ) { const int FREEZING = 0; float temperature ; int cold_ days

More information

穨control.PDF

穨control.PDF TCP congestion control yhmiu Outline Congestion control algorithms Purpose of RFC2581 Purpose of RFC2582 TCP SS-DR 1998 TCP Extensions RFC1072 1988 SACK RFC2018 1996 FACK 1996 Rate-Halving 1997 OldTahoe

More information

C

C C 2017 4 1 1. 2. while 3. 4. 5. for 6. 2/161 C 7. 8. (do while) 9. 10. (nested loop) 11. 12. 3/161 C 1. I 1 // summing.c: 2 #include 3 int main(void) 4 { 5 long num; 6 long sum = 0L; 7 int status;

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 177 [P179] (1) - [P181] [P182] (2) - for [P183] (3) - switch [P184] [P187] [P189] [P194] 178 [ ]; : : int var; : int var[3]; var 2293620 var[0] var[1] 2293620

More information

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM CHAPTER 6 SQL SQL SQL 6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM 3. 1986 10 ANSI SQL ANSI X3. 135-1986

More information

Microsoft Word - TIP006SCH Uni-edit Writing Tip - Presentperfecttenseandpasttenseinyourintroduction readytopublish

Microsoft Word - TIP006SCH Uni-edit Writing Tip - Presentperfecttenseandpasttenseinyourintroduction readytopublish 我 难 度 : 高 级 对 们 现 不 在 知 仍 道 有 听 影 过 响 多 少 那 次 么 : 研 英 究 过 文 论 去 写 文 时 作 的 表 技 引 示 巧 言 事 : 部 情 引 分 发 言 该 生 使 在 中 用 过 去, 而 现 在 完 成 时 仅 表 示 事 情 发 生 在 过 去, 并 的 哪 现 种 在 时 完 态 成 呢 时? 和 难 过 道 去 不 时 相 关? 是 所 有

More information

資料結構之C語言重點複習

資料結構之C語言重點複習 鏈結串列自編教材 ( 一 ) 本教材 ( 一 ) 目標問題 : 每次以亂數產生一 [0,1000] 之整數值, 若該值 >100, 則以同方式繼續產生下一亂數值, 若該值

More information

構 築 4 列 牌 陣 從 剩 餘 的 牌 庫 頂 抽 4 張 牌, 面 朝 上 排 列 在 桌 子 中 央 這 4 張 牌 就 是 牌 陣 的 起 始 牌, 包 括 這 張 起 始 牌 在 內, 每 一 列 最 多 只 能 容 納 5 張 牌 將 剩 餘 的 牌 暫 時 置 於 一 旁, 在 下

構 築 4 列 牌 陣 從 剩 餘 的 牌 庫 頂 抽 4 張 牌, 面 朝 上 排 列 在 桌 子 中 央 這 4 張 牌 就 是 牌 陣 的 起 始 牌, 包 括 這 張 起 始 牌 在 內, 每 一 列 最 多 只 能 容 納 5 張 牌 將 剩 餘 的 牌 暫 時 置 於 一 旁, 在 下 人 數 :2-10 人 年 齡 :10 歲 以 上 遊 戲 配 件 :104 張 紙 牌,1 份 遊 戲 說 明 書 遊 戲 目 標 不 要 得 到 任 何 紙 牌 你 所 得 到 的 紙 牌 上 的 每 個 牛 頭 都 是 負 分, 當 遊 戲 結 束 時, 得 到 最 少 牛 頭 的 玩 家 獲 勝 遊 戲 準 備 請 準 備 一 支 筆 及 一 張 紙 來 計 分 將 所 有 的 牌 洗 牌

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 9 [P.11] : Dev C++ [P.12] : http://c.feis.tw [P.13] [P.14] [P.15] [P.17] [P.23] Dev C++ [P.24] [P.27] [P.34] C / C++ [P.35] 10 C / C++ C C++ C C++ C++ C ( ) C++

More information

Microsoft PowerPoint - STU_EC_Ch04.ppt

Microsoft PowerPoint - STU_EC_Ch04.ppt 樹德科技大學資訊工程系 Chapter 4: Boolean Algebra and Logic Simplification Shi-Huang Chen Fall 200 Outline Boolean Operations and Expressions Laws and Rules of Boolean Algebra DeMorgan's Theorems Boolean Analysis

More information

PowerPoint Presentation

PowerPoint Presentation Chapter 6 Arrays ( 陣列 ) 1 Outline 6.1 Introduction 6.2 Arrays 6.3 Declaring Arrays 6.4 Examples Using Arrays 6.5 Passing Arrays to Functions 6.6 Sorting Arrays 6.7 Case Study: Computing Mean, Median and

More information

3.1 num = 3 ch = 'C' 2

3.1 num = 3 ch = 'C' 2 Java 1 3.1 num = 3 ch = 'C' 2 final 3.1 final : final final double PI=3.1415926; 3 3.2 4 int 3.2 (long int) (int) (short int) (byte) short sum; // sum 5 3.2 Java int long num=32967359818l; C:\java\app3_2.java:6:

More information

ENGG1410-F Tutorial 6

ENGG1410-F Tutorial 6 Jianwen Zhao Department of Computer Science and Engineering The Chinese University of Hong Kong 1/16 Problem 1. Matrix Diagonalization Diagonalize the following matrix: A = [ ] 1 2 4 3 2/16 Solution The

More information

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO Car DVD New GUI IR Flow User Manual V0.1 Jan 25, 2008 19, Innovation First Road Science Park Hsin-Chu Taiwan 300 R.O.C. Tel: 886-3-578-6005 Fax: 886-3-578-4418 Web: www.sunplus.com Important Notice SUNPLUS

More information

Microsoft PowerPoint - Bronson-v3-ch07.ppt [相容模式]

Microsoft PowerPoint - Bronson-v3-ch07.ppt [相容模式] C++ FOR ENGINEERS AND SCIENTISTS THIRD EDITION Chapter 7 Arrays Objectives 2 In this chapter, you will learn about: One-dimensional arrays 一維陣列 Array initialization 陣列起始化 Declaring and processing two-dimensional

More information

天 主 教 輔 仁 大 學 社 會 學 系 學 士 論 文 小 別 勝 新 婚? 久 別 要 離 婚? 影 響 遠 距 家 庭 婚 姻 感 情 因 素 之 探 討 Separate marital relations are getting better or getting worse? -Exp

天 主 教 輔 仁 大 學 社 會 學 系 學 士 論 文 小 別 勝 新 婚? 久 別 要 離 婚? 影 響 遠 距 家 庭 婚 姻 感 情 因 素 之 探 討 Separate marital relations are getting better or getting worse? -Exp 天 主 教 輔 仁 大 學 社 會 學 系 學 士 論 文 小 別 勝 新 婚? 久 別 要 離 婚? 影 響 遠 距 家 庭 婚 姻 感 情 因 素 之 探 討 Separate marital relations are getting better or getting worse? -Explore the impact of emotional factors couples do not

More information

Microsoft Word - 第四組心得.doc

Microsoft Word - 第四組心得.doc 徐 婉 真 這 四 天 的 綠 島 人 權 體 驗 營 令 我 印 象 深 刻, 尤 其 第 三 天 晚 上 吳 豪 人 教 授 的 那 堂 課, 他 讓 我 聽 到 不 同 於 以 往 的 正 義 之 聲 轉 型 正 義, 透 過 他 幽 默 熱 情 的 語 調 激 起 了 我 對 政 治 的 興 趣, 願 意 在 未 來 多 關 心 社 會 多 了 解 政 治 第 一 天 抵 達 綠 島 不 久,

More information

Microsoft Word - template.doc

Microsoft Word - template.doc HGC efax Service User Guide I. Getting Started Page 1 II. Fax Forward Page 2 4 III. Web Viewing Page 5 7 IV. General Management Page 8 12 V. Help Desk Page 13 VI. Logout Page 13 Page 0 I. Getting Started

More information

untitled

untitled 不 料 料 例 : ( 料 ) 串 度 8 年 數 串 度 4 串 度 數 數 9- ( ) 利 數 struct { ; ; 數 struct 數 ; 9-2 數 利 數 C struct 數 ; C++ 數 ; struct 省略 9-3 例 ( 料 例 ) struct people{ char name[]; int age; char address[4]; char phone[]; int

More information

Windows XP

Windows XP Windows XP What is Windows XP Windows is an Operating System An Operating System is the program that controls the hardware of your computer, and gives you an interface that allows you and other programs

More information

2/80 2

2/80 2 2/80 2 3/80 3 DSP2400 is a high performance Digital Signal Processor (DSP) designed and developed by author s laboratory. It is designed for multimedia and wireless application. To develop application

More information

untitled

untitled Co-integration and VECM Yi-Nung Yang CYCU, Taiwan May, 2012 不 列 1 Learning objectives Integrated variables Co-integration Vector Error correction model (VECM) Engle-Granger 2-step co-integration test Johansen

More information

入學考試網上報名指南

入學考試網上報名指南 入 學 考 試 網 上 報 名 指 南 On-line Application Guide for Admission Examination 16/01/2015 University of Macau Table of Contents Table of Contents... 1 A. 新 申 請 網 上 登 記 帳 戶 /Register for New Account... 2 B. 填

More information

BC04 Module_antenna__ doc

BC04 Module_antenna__ doc http://www.infobluetooth.com TEL:+86-23-68798999 Fax: +86-23-68889515 Page 1 of 10 http://www.infobluetooth.com TEL:+86-23-68798999 Fax: +86-23-68889515 Page 2 of 10 http://www.infobluetooth.com TEL:+86-23-68798999

More information

A Study on the Relationships of the Co-construction Contract A Study on the Relationships of the Co-Construction Contract ( ) ABSTRACT Co-constructio in the real estate development, holds the quite

More information

Open topic Bellman-Ford算法与负环

Open topic   Bellman-Ford算法与负环 Open topic Bellman-Ford 2018 11 5 171860508@smail.nju.edu.cn 1/15 Contents 1. G s BF 2. BF 3. BF 2/15 BF G Bellman-Ford false 3/15 BF G Bellman-Ford false G c = v 0, v 1,..., v k (v 0 = v k ) k w(v i 1,

More information

Microsoft PowerPoint - STU_EC_Ch08.ppt

Microsoft PowerPoint - STU_EC_Ch08.ppt 樹德科技大學資訊工程系 Chapter 8: Counters Shi-Huang Chen Fall 2010 1 Outline Asynchronous Counter Operation Synchronous Counter Operation Up/Down Synchronous Counters Design of Synchronous Counters Cascaded Counters

More information

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 C C trio@seu.edu.cn C C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 Week3 C Week5 Week5 Memory & Pointer

More information

FY.DOC

FY.DOC 高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主

More information

124 第十三期 Conflicts in the Takeover of the Land in Taiwan after the Sino-Japanese War A Case in the Change of the Japanese Names of the Taiwanese Peopl

124 第十三期 Conflicts in the Takeover of the Land in Taiwan after the Sino-Japanese War A Case in the Change of the Japanese Names of the Taiwanese Peopl 123 戰後初期臺灣土地接收的糾紛 以更改日式姓名的臺人遭遇為例 124 第十三期 Conflicts in the Takeover of the Land in Taiwan after the Sino-Japanese War A Case in the Change of the Japanese Names of the Taiwanese People Abstract By Ho Fung-jiao

More information

Microsoft Word - ChineseSATII .doc

Microsoft Word - ChineseSATII .doc 中 文 SAT II 冯 瑶 一 什 么 是 SAT II 中 文 (SAT Subject Test in Chinese with Listening)? SAT Subject Test 是 美 国 大 学 理 事 会 (College Board) 为 美 国 高 中 生 举 办 的 全 国 性 专 科 标 准 测 试 考 生 的 成 绩 是 美 国 大 学 录 取 新 生 的 重 要 依

More information

A Community Guide to Environmental Health

A Community Guide to Environmental Health 102 7 建 造 厕 所 本 章 内 容 宣 传 推 广 卫 生 设 施 104 人 们 需 要 什 么 样 的 厕 所 105 规 划 厕 所 106 男 女 对 厕 所 的 不 同 需 求 108 活 动 : 给 妇 女 带 来 方 便 110 让 厕 所 更 便 于 使 用 111 儿 童 厕 所 112 应 急 厕 所 113 城 镇 公 共 卫 生 设 施 114 故 事 : 城 市 社

More information

Preface This guide is intended to standardize the use of the WeChat brand and ensure the brand's integrity and consistency. The guide applies to all d

Preface This guide is intended to standardize the use of the WeChat brand and ensure the brand's integrity and consistency. The guide applies to all d WeChat Search Visual Identity Guidelines WEDESIGN 2018. 04 Preface This guide is intended to standardize the use of the WeChat brand and ensure the brand's integrity and consistency. The guide applies

More information

C o n t e n t s...7... 15 1. Acceptance... 17 2. Allow Love... 19 3. Apologize... 21 4. Archangel Metatron... 23 5. Archangel Michael... 25 6. Ask for

C o n t e n t s...7... 15 1. Acceptance... 17 2. Allow Love... 19 3. Apologize... 21 4. Archangel Metatron... 23 5. Archangel Michael... 25 6. Ask for Doreen Virtue, Ph.D. Charles Virtue C o n t e n t s...7... 15 1. Acceptance... 17 2. Allow Love... 19 3. Apologize... 21 4. Archangel Metatron... 23 5. Archangel Michael... 25 6. Ask for a Sign... 27 7.

More information

LEETCODE leetcode.com 一 个 在 线 编 程 网 站, 收 集 了 IT 公 司 的 面 试 题, 包 括 算 法, 数 据 库 和 shell 算 法 题 支 持 多 种 语 言, 包 括 C, C++, Java, Python 等 2015 年 3 月 份 加 入 了 R

LEETCODE leetcode.com 一 个 在 线 编 程 网 站, 收 集 了 IT 公 司 的 面 试 题, 包 括 算 法, 数 据 库 和 shell 算 法 题 支 持 多 种 语 言, 包 括 C, C++, Java, Python 等 2015 年 3 月 份 加 入 了 R 用 RUBY 解 LEETCODE 算 法 题 RUBY CONF CHINA 2015 By @quakewang LEETCODE leetcode.com 一 个 在 线 编 程 网 站, 收 集 了 IT 公 司 的 面 试 题, 包 括 算 法, 数 据 库 和 shell 算 法 题 支 持 多 种 语 言, 包 括 C, C++, Java, Python 等 2015 年 3 月 份

More information

<4D6963726F736F667420576F7264202D2032303130C4EAC0EDB9A4C0E04142BCB6D4C4B6C1C5D0B6CFC0FDCCE2BEABD1A15F325F2E646F63>

<4D6963726F736F667420576F7264202D2032303130C4EAC0EDB9A4C0E04142BCB6D4C4B6C1C5D0B6CFC0FDCCE2BEABD1A15F325F2E646F63> 2010 年 理 工 类 AB 级 阅 读 判 断 例 题 精 选 (2) Computer mouse How does the mouse work? We have to start at the bottom, so think upside down for now. It all starts with mouse ball. As the mouse ball in the bottom

More information

PowerPoint Presentation

PowerPoint Presentation ITM omputer and ommunication Technologies Lecture #4 Part I: Introduction to omputer Technologies Logic ircuit Design & Simplification ITM 計算機與通訊技術 2 23 香港中文大學電子工程學系 Logic function implementation Logic

More information

Microsoft Word doc

Microsoft Word doc 中 考 英 语 科 考 试 标 准 及 试 卷 结 构 技 术 指 标 构 想 1 王 后 雄 童 祥 林 ( 华 中 师 范 大 学 考 试 研 究 院, 武 汉,430079, 湖 北 ) 提 要 : 本 文 从 结 构 模 式 内 容 要 素 能 力 要 素 题 型 要 素 难 度 要 素 分 数 要 素 时 限 要 素 等 方 面 细 致 分 析 了 中 考 英 语 科 试 卷 结 构 的

More information

Untitled-3

Untitled-3 SEC.. Separable Equations In each of problems 1 through 8 solve the given differential equation : ü 1. y ' x y x y, y 0 fl y - x 0 fl y - x 0 fl y - x3 3 c, y 0 ü. y ' x ^ y 1 + x 3 x y 1 + x 3, y 0 fl

More information

Microsoft Word - Final Exam Review Packet.docx

Microsoft Word - Final Exam Review Packet.docx Do you know these words?... 3.1 3.5 Can you do the following?... Ask for and say the date. Use the adverbial of time correctly. Use Use to ask a tag question. Form a yes/no question with the verb / not

More information

Abstract Yiwei( 易 緯 ) is one of the most important elements in Yi ( 易 )study of Han dynasty. It had rich meanings and close relation with other parts

Abstract Yiwei( 易 緯 ) is one of the most important elements in Yi ( 易 )study of Han dynasty. It had rich meanings and close relation with other parts 中 文 系 一 四 年 度 碩 士 位 論 文 指 導 教 授 : 陳 睿 宏 教 授 鄭 玄 易 緯 注 及 其 詮 釋 述 評 研 究 生 : 邵 吉 辰 通 過 日 期 : 一 五 年 六 月 Abstract Yiwei( 易 緯 ) is one of the most important elements in Yi ( 易 )study of Han dynasty. It had rich

More information

Lorem ipsum dolor sit amet, consectetuer adipiscing elit

Lorem ipsum dolor sit amet, consectetuer adipiscing elit English for Study in Australia 留 学 澳 洲 英 语 讲 座 Lesson 3: Make yourself at home 第 三 课 : 宾 至 如 归 L1 Male: 各 位 朋 友 好, 欢 迎 您 收 听 留 学 澳 洲 英 语 讲 座 节 目, 我 是 澳 大 利 亚 澳 洲 广 播 电 台 的 节 目 主 持 人 陈 昊 L1 Female: 各 位

More information

VASP应用运行优化

VASP应用运行优化 1 VASP wszhang@ustc.edu.cn April 8, 2018 Contents 1 2 2 2 3 2 4 2 4.1........................................................ 2 4.2..................................................... 3 5 4 5.1..........................................................

More information

spss.doc

spss.doc SPSS 8 8.1 K-Means Cluster [ 8-1] 1962 1988 8-1 2 5 31 3 7 20 F2-F3 2 3 F3-F4 3 4 109 8 8-1 2 3 2 3 F2-F3 F3-F4 1962 344 3333 29 9 9.69 1.91 1963 121 1497 27 19 12.37 1.34 1964 187 1813 32 18 9.70 1.06

More information

Microsoft PowerPoint - 04-array_pointer.ppt

Microsoft PowerPoint - 04-array_pointer.ppt Array 與 Pointer Array Dynamical Memory Allocation Array( 陣列 ) 陣列是用來存放同樣型態的資料陣列的大小必須在程式中預先設定在程式執行中, 陣列的大小無法改變陣列中的資料是透過索引 (index) 來存取 一維陣列的宣告 type array_name[array_size]; int iarray[100]; /* an integer array

More information

東莞工商總會劉百樂中學

東莞工商總會劉百樂中學 /2015/ 頁 (2015 年 版 ) 目 錄 : 中 文 1 English Language 2-3 數 學 4-5 通 識 教 育 6 物 理 7 化 學 8 生 物 9 組 合 科 學 ( 化 學 ) 10 組 合 科 學 ( 生 物 ) 11 企 業 會 計 及 財 務 概 論 12 中 國 歷 史 13 歷 史 14 地 理 15 經 濟 16 資 訊 及 通 訊 科 技 17 視 覺

More information

穨1-林聖欽.doc

穨1-林聖欽.doc 1 39 92 11 Geographical Research No. 39, November. 2003 * The historical geographical study of the Taiwanese christening culture: A case of Xuei-gia-liau, Xuei-gia Bau, Yan-Shui-Gang Ting in Japanese Rule

More information

hks298cover&back

hks298cover&back 2957 6364 2377 3300 2302 1087 www.scout.org.hk scoutcraft@scout.org.hk 2675 0011 5,500 Service and Scouting Recently, I had an opportunity to learn more about current state of service in Hong Kong

More information

c_cpp

c_cpp C C++ C C++ C++ (object oriented) C C++.cpp C C++ C C++ : for (int i=0;i

More information

341-367

341-367 BIBLID 0254-4466(2000)18:2 pp. 341-367 18 2 89 12 341 342 1 2 3 1 19 1983 2 3 1996. 10 1218 343 4 5 6 7 11 8 28 9 10 11 12 13 14 4 3 1808 5 3 1349 6 3 343 7 3 1292 8 9 1996 4 988 10 3 187 11 3 1506 12

More information

從詩歌的鑒賞談生命價值的建構

從詩歌的鑒賞談生命價值的建構 Viktor E. Frankl (logotherapy) (will-to-meaning) (creative values) Ture (Good) (Beauty) (experiential values) (attitudinal values) 1 2 (logotherapy) (biological) (2) (psychological) (3) (noölogical) (4)

More information

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023) ( CIP) /. :, 2005. 2 ( ) ISBN 7-5624-3339-9.......... TP311. 1 CIP ( 2005) 011794 : : : : * : : 174 ( A ) :400030 : ( 023) 65102378 65105781 : ( 023) 65103686 65105565 : http: / /www. cqup. com. cn : fxk@cqup.

More information

(baking powder) 1 ( ) ( ) 1 10g g (two level design, D-optimal) 32 1/2 fraction Two Level Fractional Factorial Design D-Optimal D

(baking powder) 1 ( ) ( ) 1 10g g (two level design, D-optimal) 32 1/2 fraction Two Level Fractional Factorial Design D-Optimal D ( ) 4 1 1 1 145 1 110 1 (baking powder) 1 ( ) ( ) 1 10g 1 1 2.5g 1 1 1 1 60 10 (two level design, D-optimal) 32 1/2 fraction Two Level Fractional Factorial Design D-Optimal Design 1. 60 120 2. 3. 40 10

More information

一 課 後 社 團 名 稱 :B02. 直 排 輪 校 隊 C 班 ( 校 隊 班 ) 二 授 課 教 師 : 劉 輔 人 助 教 : 杜 翊 嘉 2011 2013 世 界 盃 滑 輪 溜 冰 錦 標 賽 世 界 冠 軍 榮 獲 VOUGE 時 尚 雜 誌 專 訪 同 週 一 校 隊 班 介 紹

一 課 後 社 團 名 稱 :B02. 直 排 輪 校 隊 C 班 ( 校 隊 班 ) 二 授 課 教 師 : 劉 輔 人 助 教 : 杜 翊 嘉 2011 2013 世 界 盃 滑 輪 溜 冰 錦 標 賽 世 界 冠 軍 榮 獲 VOUGE 時 尚 雜 誌 專 訪 同 週 一 校 隊 班 介 紹 一 課 後 社 團 名 稱 :B01. 直 排 輪 綜 合 B 班 ( 綜 合 班 ) 二 授 課 教 師 : 郭 佳 佩 助 教 : 同 週 一 校 隊 B 班 介 紹 同 週 一 綜 合 A 班 第 1 週 同 週 一 綜 合 A 班 第 2 週 同 週 一 綜 合 A 班 第 3 週 同 週 一 綜 合 A 班 第 4 週 同 週 一 綜 合 A 班 第 5 週 同 週 一 綜 合 A 班 第

More information

untitled

untitled Introduction to Programming ( 數 ) Lecture 3 Spring 2005 March 4, 2005 Lecture 2 Outline 數 料 If if 狀 if 2 (Standard Output, stdout): 料. ((Standard Input, stdin): 料. 類 數 數 數 說 printf 見 數 puts 串 數 putchar

More information

東吳大學

東吳大學 律 律 論 論 療 行 The Study on Medical Practice and Coercion 林 年 律 律 論 論 療 行 The Study on Medical Practice and Coercion 林 年 i 讀 臨 療 留 館 讀 臨 律 六 礪 讀 不 冷 療 臨 年 裡 歷 練 禮 更 老 林 了 更 臨 不 吝 麗 老 劉 老 論 諸 見 了 年 金 歷 了 年

More information

新版 明解C++入門編

新版 明解C++入門編 511!... 43, 85!=... 42 "... 118 " "... 337 " "... 8, 290 #... 71 #... 413 #define... 128, 236, 413 #endif... 412 #ifndef... 412 #if... 412 #include... 6, 337 #undef... 413 %... 23, 27 %=... 97 &... 243,

More information

3 月 17 日 托 三 班 正 式 开 班 了, 才 来 的 时 候 他 们 舍 不 得 离 开 爸 爸 妈 妈 和 熟 悉 的 家 庭, 到 现 在 半 个 月 过 去 了, 孩 子 们 对 幼 儿 园 的 生 活 已 经 非 常 熟 悉 了 而 这 半 个 月 的 时 间 里 他 们 也 成 长 了 许 多, 他 们 不 仅 不 哭 了, 还 能 做 到 独 立 入 厕 独 立 洗 手 独 立

More information

软件测试(TA07)第一学期考试

软件测试(TA07)第一学期考试 一 判 断 题 ( 每 题 1 分, 正 确 的, 错 误 的,20 道 ) 1. 软 件 测 试 按 照 测 试 过 程 分 类 为 黑 盒 白 盒 测 试 ( ) 2. 在 设 计 测 试 用 例 时, 应 包 括 合 理 的 输 入 条 件 和 不 合 理 的 输 入 条 件 ( ) 3. 集 成 测 试 计 划 在 需 求 分 析 阶 段 末 提 交 ( ) 4. 单 元 测 试 属 于 动

More information

前 言 一 場 交 換 學 生 的 夢, 夢 想 不 只 是 敢 夢, 而 是 也 要 敢 去 實 踐 為 期 一 年 的 交 換 學 生 生 涯, 說 長 不 長, 說 短 不 短 再 長 的 路, 一 步 步 也 能 走 完 ; 再 短 的 路, 不 踏 出 起 步 就 無 法 到 達 這 次

前 言 一 場 交 換 學 生 的 夢, 夢 想 不 只 是 敢 夢, 而 是 也 要 敢 去 實 踐 為 期 一 年 的 交 換 學 生 生 涯, 說 長 不 長, 說 短 不 短 再 長 的 路, 一 步 步 也 能 走 完 ; 再 短 的 路, 不 踏 出 起 步 就 無 法 到 達 這 次 壹 教 育 部 獎 助 國 內 大 學 校 院 選 送 優 秀 學 生 出 國 研 修 之 留 學 生 成 果 報 告 書 奧 地 利 約 翰 克 卜 勒 大 學 (JKU) 留 學 心 得 原 就 讀 學 校 / 科 系 / 年 級 : 長 榮 大 學 / 財 務 金 融 學 系 / 四 年 級 獲 獎 生 姓 名 : 賴 欣 怡 研 修 國 家 : 奧 地 利 研 修 學 校 : 約 翰 克 普

More information

Excel VBA Excel Visual Basic for Application

Excel VBA  Excel Visual Basic for Application Excel VBA Jun5,00 Sub 分頁 () Dim i As Integer Dim Cname As String Dim Code As Variant Set score=thisworkbook.sheets("sheet") Code=Array(" 專北一 "," 專北二 "," 專北三 "," 專桃園 "," 專桃竹 "," 專中苗 ", " 專台中 "," 專台南 ","

More information

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc 2 5 8 11 0 13 1. 13 2. 15 3. 18 1 23 1. 23 2. 26 3. 28 2 36 1. 36 2. 39 3. 42 4. 44 5. 49 6. 51 3 57 1. 57 2. 60 3. 64 4. 66 5. 70 6. 75 7. 83 8. 85 9. 88 10. 98 11. 103 12. 108 13. 112 4 115 1. 115 2.

More information

AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING

AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING 前言 - Andrew Payne 目录 1 2 Firefly Basics 3 COMPONENT TOOLBOX 目录 4 RESOURCES 致谢

More information

國 立 屏 東 教 育 大 學 中 國 語 文 學 系 碩 士 班 碩 士 論 文 國 小 國 語 教 科 書 修 辭 格 分 析 以 南 一 版 為 例 指 導 教 授 : 柯 明 傑 博 士 研 究 生 : 鄺 綺 暖 撰 中 華 民 國 一 百 零 二 年 七 月 謝 辭 寫 作 論 文 的 日 子 終 於 畫 下 了 句 點, 三 年 前 懷 著 對 文 學 的 熱 愛, 報 考 了 中

More information

K301Q-D VRT中英文说明书141009

K301Q-D VRT中英文说明书141009 THE INSTALLING INSTRUCTION FOR CONCEALED TANK Important instuction:.. Please confirm the structure and shape before installing the toilet bowl. Meanwhile measure the exact size H between outfall and infall

More information

symmetrical cutting patterns with various materials for visual designing; ii. This part combined costumes, bags and oilpaper umbrellas with the tradit

symmetrical cutting patterns with various materials for visual designing; ii. This part combined costumes, bags and oilpaper umbrellas with the tradit The Application of Chinese Paper Cutting Patterns to Bag,Costume Designs and oilpaper umbrella TSAI,Yi-lun LIN,Yu-wen Abstract Using bags and costumes is regarded as the extension of human body, and the

More information

南華大學數位論文

南華大學數位論文 南華大學 碩士論文 中華民國九十五年六月十四日 Elfin Excel I II III ABSTRACT Since Ming Hwa Yuan Taiwanese Opera Company started to cooperate with the Chinese orchestra, the problem of how the participation of Chinese music

More information

Microsoft Word - (web)_F.1_Notes_&_Application_Form(Chi)(non-SPCCPS)_16-17.doc

Microsoft Word - (web)_F.1_Notes_&_Application_Form(Chi)(non-SPCCPS)_16-17.doc 聖 保 羅 男 女 中 學 學 年 中 一 入 學 申 請 申 請 須 知 申 請 程 序 : 請 將 下 列 文 件 交 回 本 校 ( 麥 當 勞 道 33 號 ( 請 以 A4 紙 張 雙 面 影 印, 並 用 魚 尾 夾 夾 起 : 填 妥 申 請 表 並 貼 上 近 照 小 學 五 年 級 上 下 學 期 成 績 表 影 印 本 課 外 活 動 表 現 及 服 務 的 證 明 文 件 及

More information

Microsoft Word - Book9

Microsoft Word - Book9 葬 書 ( 下 ) 佈 陣 十 方 成 立 指 揮 中 心 層 巒 疊 障 千 山 翠 微, 紓 回 連 綿 的 重 山 復 重 山, 侍 朝 衛 迎, 前 後 有 序, 巋 巘 隱 逸 著 一 片 風 水 寶 地, 牛 臥 馬 馳, 鸞 飛 鳳 舞, 滕 蛇 委 蛇, 縈 藟 纏 繞 在 葺 襲 的 斷 續 峰 巒 之 間! 離 正 午 十 二 時 整 還 有 半 個 鐘 頭, 接 近 天 頂 的

More information

UDC The Policy Risk and Prevention in Chinese Securities Market

UDC The Policy Risk and Prevention in Chinese Securities Market 10384 200106013 UDC The Policy Risk and Prevention in Chinese Securities Market 2004 5 2004 2004 2004 5 : Abstract Many scholars have discussed the question about the influence of the policy on Chinese

More information

摘 要 張 捷 明 是 台 灣 當 代 重 要 的 客 語 兒 童 文 學 作 家, 他 的 作 品 記 錄 著 客 家 人 的 思 想 文 化 與 觀 念, 也 曾 榮 獲 多 項 文 學 大 獎 的 肯 定, 對 台 灣 這 塊 土 地 上 的 客 家 人 有 著 深 厚 的 情 感 張 氏 於

摘 要 張 捷 明 是 台 灣 當 代 重 要 的 客 語 兒 童 文 學 作 家, 他 的 作 品 記 錄 著 客 家 人 的 思 想 文 化 與 觀 念, 也 曾 榮 獲 多 項 文 學 大 獎 的 肯 定, 對 台 灣 這 塊 土 地 上 的 客 家 人 有 著 深 厚 的 情 感 張 氏 於 玄 奘 大 學 中 國 語 文 學 系 碩 士 論 文 客 家 安 徒 生 張 捷 明 童 話 研 究 指 導 教 授 : 羅 宗 濤 博 士 研 究 生 : 黃 春 芳 撰 中 華 民 國 一 0 二 年 六 月 摘 要 張 捷 明 是 台 灣 當 代 重 要 的 客 語 兒 童 文 學 作 家, 他 的 作 品 記 錄 著 客 家 人 的 思 想 文 化 與 觀 念, 也 曾 榮 獲 多 項 文

More information

<4D6963726F736F667420576F7264202D205F4230365FB942A5CEA668B443C5E9BB73A740B5D8A4E5B8C9A552B1D0A7F75FA6BFB1A4ACFC2E646F63>

<4D6963726F736F667420576F7264202D205F4230365FB942A5CEA668B443C5E9BB73A740B5D8A4E5B8C9A552B1D0A7F75FA6BFB1A4ACFC2E646F63> 運 用 多 媒 體 製 作 華 文 補 充 教 材 江 惜 美 銘 傳 大 學 應 用 中 文 系 chm248@gmail.com 摘 要 : 本 文 旨 在 探 究 如 何 運 用 多 媒 體, 結 合 文 字 聲 音 圖 畫, 製 作 華 文 補 充 教 材 當 我 們 在 進 行 華 文 教 學 時, 往 往 必 須 透 過 教 案 設 計, 並 製 作 補 充 教 材, 方 能 使 教 學

More information

科学计算的语言-FORTRAN95

科学计算的语言-FORTRAN95 科 学 计 算 的 语 言 -FORTRAN95 目 录 第 一 篇 闲 话 第 1 章 目 的 是 计 算 第 2 章 FORTRAN95 如 何 描 述 计 算 第 3 章 FORTRAN 的 编 译 系 统 第 二 篇 计 算 的 叙 述 第 4 章 FORTRAN95 语 言 的 形 貌 第 5 章 准 备 数 据 第 6 章 构 造 数 据 第 7 章 声 明 数 据 第 8 章 构 造

More information

csg(1_29)cs.p65

csg(1_29)cs.p65 DP-80F 2 2 3 4 5 4 5 2 3 4 5 3 ENERGY STAR ENERGY STAR ENERGY STAR 4 3 3 4 7 7 8 8 8 9 0 2 2 3 4 6 7 8 8 9 20 2 22 23 23 24 26 27 27 28 29 30 3 32 33 5 37 37 38 38 39 4 46 46 48 49 50 52 6 7 8 9 q w e

More information

Microsoft Word - ED-774.docx

Microsoft Word - ED-774.docx journal.newcenturyscience.com/index.php/gjanp Global Journal of Advanced Nursing Practice,214,Vol.1,No.1 The practicality of an improved method of intravenous infusion exhaust specialized in operating

More information

Guide to Install SATA Hard Disks

Guide to Install SATA Hard Disks SATA RAID 1. SATA. 2 1.1 SATA. 2 1.2 SATA 2 2. RAID (RAID 0 / RAID 1 / JBOD).. 4 2.1 RAID. 4 2.2 RAID 5 2.3 RAID 0 6 2.4 RAID 1.. 10 2.5 JBOD.. 16 3. Windows 2000 / Windows XP 20 1. SATA 1.1 SATA Serial

More information

2

2 40 2 3 4 5 ^ ^ 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 PLEASE AFFIX STAMP HERE Diabetes Hongkong Unit 1802, 18/F., Tung Hip Commercial Bldg., 244-252 Des Voeux Rd C, HK. Diabetes Hongkong membership

More information

C语言的应用.PDF

C语言的应用.PDF AVR C 9 1 AVR C IAR C, *.HEX, C,,! C, > 9.1 AVR C MCU,, AVR?! IAR AVR / IAR 32 ALU 1KBytes - 8MBytes (SPM ) 16 MBytes C C *var1, *var2; *var1++ = *--var2; AVR C 9 2 LD R16,-X ST Z+,R16 Auto (local

More information

: : : : : ISBN / C53:H : 19.50

: : : : : ISBN / C53:H : 19.50 : : : : 2002 1 1 2002 1 1 : ISBN 7-224-06364-9 / C53:H059-53 : 19.50 50,,,,,,, ; 50,,,,,,,, 1 ,,,,,,,,,,,,,, ;,,,,,,,,, 2 ,,,, 2002 8 3 ( 1 ) ( 1 ) Deduction One Way of Deriving the Meaning of U nfamiliar

More information

Microsoft PowerPoint - L17_Inheritance_v4.pptx

Microsoft PowerPoint - L17_Inheritance_v4.pptx C++ Programming Lecture 17 Wei Liu ( 刘 威 ) Dept. of Electronics and Information Eng. Huazhong University of Science and Technology May. 2015 Lecture 17 Chapter 20. Object-Oriented Programming: Inheritance

More information

Microsoft Word - ACG chapter00c-3ed.docx

Microsoft Word - ACG chapter00c-3ed.docx Python 好好玩, 趣學電玩遊戲程式設計 Python Python BASIC Java JavaScript PHP C++ BASIC Python Python Python Xbox PlayStation Nintendo - 2 - 簡介 : 互動式 Python Shell : 編寫程式 Python File editor : 猜數字 : 腦筋急轉彎 : 龍域 ( ) : 使用

More information

世新稿件end.doc

世新稿件end.doc Research Center For Taiwan Economic Development (RCTED) 2003 8 1 2 Study of Operational Strategies on Biotechnology Pharmaceutical Products Industry in Taiwan -- Case Study on Sinphar Pharmaceutical Company

More information

2015 Chinese FL Written examination

2015 Chinese FL Written examination Victorian Certificate of Education 2015 SUPERVISOR TO ATTACH PROCESSING LABEL HERE Letter STUDENT NUMBER CHINESE FIRST LANGUAGE Written examination Monday 16 November 2015 Reading time: 11.45 am to 12.00

More information

錫安教會2015年11月29日分享

錫安教會2015年11月29日分享 錫 安 教 會 2015 年 11 月 29 日 分 享 第 一 章 : 天 馬 座 行 動 答 問 篇 (2) 問 題 (1): 信 息 中 曾 提 及, 有 一 群 忠 良 的 皇 者 和 精 英 製 造 共 同 信 息, 但 亦 有 一 群 奸 惡 的 如 果 將 來 他 們 來 尋 找 我 們, 顯 示 他 們 是 製 造 共 同 信 息 的 人 這 樣, 我 們 有 沒 有 需 要 或 者

More information

PowerPoint Presentation

PowerPoint Presentation TOEFL Practice Online User Guide Revised September 2009 In This Guide General Tips for Using TOEFL Practice Online Directions for New Users Directions for Returning Users 2 General Tips To use TOEFL Practice

More information

Logitech Wireless Combo MK45 English

Logitech Wireless Combo MK45 English Logitech Wireless Combo MK45 Setup Guide Logitech Wireless Combo MK45 English................................................................................... 7..........................................

More information

Chn 116 Neh.d.01.nis

Chn 116 Neh.d.01.nis 31 尼 希 米 书 尼 希 米 的 祷 告 以 下 是 哈 迦 利 亚 的 儿 子 尼 希 米 所 1 说 的 话 亚 达 薛 西 王 朝 二 十 年 基 斯 流 月 *, 我 住 在 京 城 书 珊 城 里 2 我 的 兄 弟 哈 拿 尼 和 其 他 一 些 人 从 犹 大 来 到 书 珊 城 我 向 他 们 打 听 那 些 劫 后 幸 存 的 犹 太 人 家 族 和 耶 路 撒 冷 的 情 形

More information

高中英文科教師甄試心得

高中英文科教師甄試心得 高 中 英 文 科 教 師 甄 試 心 得 英 語 學 系 碩 士 班 林 俊 呈 高 雄 市 立 高 雄 高 級 中 學 今 年 第 一 次 參 加 教 師 甄 試, 能 夠 在 尚 未 服 兵 役 前 便 考 上 高 雄 市 立 高 雄 高 級 中 學 專 任 教 師, 自 己 覺 得 很 意 外, 也 很 幸 運 考 上 後 不 久 在 與 雄 中 校 長 的 會 談 中, 校 長 的 一 句

More information

untitled

untitled 1 Outline 數 料 數 數 列 亂數 練 數 數 數 來 數 數 來 數 料 利 料 來 數 A-Z a-z _ () 不 數 0-9 數 不 數 SCHOOL School school 數 讀 school_name schoolname 易 不 C# my name 7_eleven B&Q new C# (1) public protected private params override

More information

2009.05

2009.05 2009 05 2009.05 2009.05 璆 2009.05 1 亿 平 方 米 6 万 套 10 名 20 亿 元 5 个 月 30 万 亿 60 万 平 方 米 Data 围 观 CCDI 公 司 内 刊 企 业 版 P08 围 观 CCDI 管 理 学 上 有 句 名 言 : 做 正 确 的 事, 比 正 确 地 做 事 更 重 要 方 向 的 对 错 于 大 局 的 意 义 而 言,

More information