* y * 0 1 2 (y,t) * +-----+-----+-----+ +-----+ * 0 |(0,0)|(0,1)|(0,2)| |(0,0)| 0 = 0*3+0 = t*3+y * +-----+-----+-----+ +-----+ * t 1 |(1,0)|(1,1)|(1,2)| |(0,1)| 1 = 0*3+1 = t*3+y * +-----+-----+-----+ +-----+ * 2 |(2,0)|(2,1)|(2,2)| |(0,2)| 2 = 0*3+2 = t*3+y * +-----+-----+-----+ +-----+ * +-----+-----+-----+ * 0 | 0 | 1 | 2 | * +-----+-----+-----+ * t 1 | 3 | 4 | 5 | * +-----+-----+-----+ * 2 | 6 | 7 | 8 | * +-----+-----+-----+ char a[3]; a0,a1,a2 a == &a0 a[n] == *(a + n) char board[3][3]; board00,board01,board02,board10,..,board22 の 9 個 ( 3 x 3 ) board 〜 &board[0][0] board[1] board10, board11, board12 board[1] 〜 &board[1][0] sizeof(board[1][0]) == 1 board[1][0] : char sizeof(board[1]) == 3 board[1] : char[3] board[1][n] == *(board[1] + n) board[k] == *( board + k ) board には 1000 というアドレスの情報だけでなく その要素のサイズの情報も含まれている board == 1000 board[1] => *(1003) = *(board + 1) // ポインター計算 // ポインター==アドレス値と型情報 => *(1000 + 1*sizeof(board[1])) // アドレス値の計算 => *(1000 + 1*3) => *(1003) sizeof ( X ) X がメモリを使うセルの個数 == fact(5) => n <- 5; fact ( n - 1 ) * n => fact ( 5 - 1 ) * 5 => fact ( 4 ) * 5 fact(4) n <- 4; fact ( n - 1 ) * n => fact ( 4 - 1 ) * 4 => fact ( 3 ) * 4 .. fact(0) n <- 0 1 => 1 => 1 * 2 => 1 * 2 * 3 ... => 1 * 2 * 3 * 4 * 5 = 120 == fact(5) n : bf9c8950 n <- 5 *(bf9c8950) <- 5 fcat(n-1) * n fcat(4) * n fact(4) n : bf9c8930 n <- 4 *(bf9c8930) <- 4 fcat(n-1) * n fcat(4) * n == print_int_form ( "1 st = %, 2nd = %, 3rd \n", 10, 20, 90 ); int print_int_form ( char *fmt, int a, ... ) +-----------+ fmt | --------------------> "1 st = %, 2nd = %, 3rd \n" +-----------+ +-----+ a | 10 |*(&a+0) | '1' | <- fmt[0] = fmt[i] (i = 0 の時) +-----------+ j=0 +-----+ | 20 |*(&a+1) | 's' | <- fmt[1] = fmt[i] (i = 1 の時) +-----------+ j=1 +-----+ | 90 | | 't' | +-----------+ +-----+ | .. | 1 st = 10, 2nd = 20, 3rd = 90