O'Reillyの本です。英語版を私がきちんと理解出来るか不安を感じながらもAndroid Marketで購入。
だって日本語版の書籍も電子書籍も高いんだもん。$5で買えて英語の文書を読む勉強になるなら買うしかないでしょw
少しずつ読んでるんだけどログをのこしてなかったのでこれから書きます。
現在は6. Relationships Among Classes(クラス間の関係)を読んでます。6.1 Subclassing and Inheritance(サブクラス化と継承)の@Overrideとこ。
日本語版のToCがO'Reilly Japan - 詳解 Javaプログラミング 第2版 VOLUME 1にのってるのでそっち見るか。
残念だけどblogspotよりもwiki作って書きたいかも。blogspotちょっと使いづらいんだよね orz
というわけで以降こっちに。
Learning Java読書メモ - livedoor Wiki(ウィキ)
2011年3月24日木曜日
2011年3月23日水曜日
苦C勉強会 E.15 ポインタ
E15.5
*が3つの意味をもつ(乗算、間接参照、ポインタ変数の宣言)のでややこしい
E15.6
関数の仮引数宣言ならint *aもint a[]も同じ。
配列の宣言の時は[]でサイズを書くけど配列を使う時の[]は添字演算子。意味が違う。
E15.7
int *hoge, array[10];
for(hoge = array; hoge != &array[10]; hoge++) { something }
はややこしい。
練習問題
なんか納得のいかない感じ
雑感
同じ記号なのに意味が違う事があってややこしいですね。
*が3つの意味をもつ(乗算、間接参照、ポインタ変数の宣言)のでややこしい
E15.6
関数の仮引数宣言ならint *aもint a[]も同じ。
配列の宣言の時は[]でサイズを書くけど配列を使う時の[]は添字演算子。意味が違う。
E15.7
int *hoge, array[10];
for(hoge = array; hoge != &array[10]; hoge++) { something }
はややこしい。
練習問題
なんか納得のいかない感じ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MAX_INPUT_SIZE 10 | |
int max(int *in); | |
int min(int *in); | |
int main(int argc, char *argv[]) { | |
int input[MAX_INPUT_SIZE]; | |
size_t index = 0; | |
do { | |
scanf("%d", &input[index]); | |
} while (-1 != input[index++]); | |
printf("max: %d, min: %d\n", max(input), min(input)); | |
} | |
int max(int *in) { | |
int max = *in; | |
while (-1 != *in) { | |
if (max < *in) { | |
max = *in; | |
} | |
in++; | |
} | |
return max; | |
} | |
int min(int *in) { | |
int min = *in; | |
while (-1 != *in) { | |
if (min > *in) { | |
min = *in; | |
} | |
in++; | |
} | |
return min; | |
} |
雑感
同じ記号なのに意味が違う事があってややこしいですね。
2011年3月2日水曜日
俺がそう思うからそうなんだろう 俺ん中ではな: 苦C勉強会 E.10からE.14まで
E.10.1
intのサイズについて言及があるけど、処理系依存なんでなんともいえない。最低限これだけは表現出来る!ってのがきまってるだけだったような。フォロープリーズ。
E.10.2
do ~ while文は必ず1回実行されるので入力チェックに最適。
練習問題10
doは先判定、do whileは後判定。
書取の方は結果表示とかもう一度とか抜きでかいてしまった。
練習問題11
問題をしっかりよんでなかったので変なことに
E.13.2
memory.hって何だろ…とりあえずstrings.hをincludeして話をすすめる。
練習問題13
とりあえず普通に。
E.14
charのサイズって処理系依存だったっけ?
とりあえずsignedかunsignedかは処理系依存だった。
練習問題14
手抜き
intのサイズについて言及があるけど、処理系依存なんでなんともいえない。最低限これだけは表現出来る!ってのがきまってるだけだったような。フォロープリーズ。
E.10.2
do ~ while文は必ず1回実行されるので入力チェックに最適。
練習問題10
doは先判定、do whileは後判定。
書取の方は結果表示とかもう一度とか抜きでかいてしまった。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int score; | |
do { | |
printf("テストの点数を入力してください\n"); | |
scanf("%d", &score); | |
} while (0 > score || 100 < score); | |
return 0; | |
} |
練習問題11
問題をしっかりよんでなかったので変なことに
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include <stdio.h> | |
int olympics(int year); | |
int main(void) { | |
int year; | |
scanf("%d", &year); | |
if (olympics(year)) { | |
printf("オリンピックが開かれます。\n"); | |
} else { | |
printf("オリンピックが開かれません。\n"); | |
} | |
return 0; | |
} | |
int olympics(int year) { | |
if (year < 1896) { | |
return 0; | |
} | |
if (1916 == year || 1940 == year || 1944 == year) { | |
return 0; | |
} | |
if (1994 <= year && year % 4 == 2) { | |
return 1; | |
} | |
return year % 4 == 0; | |
} |
E.13.2
memory.hって何だろ…とりあえずstrings.hをincludeして話をすすめる。
練習問題13
とりあえず普通に。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include <stdio.h> | |
int main(void) { | |
int numbers[10]; | |
int i; | |
for (i = 0; i < 10; i++) { | |
scanf("%d", &numbers[i]); | |
} | |
for (i = 9; i >= 0; i--) { | |
printf("%d\n", numbers[i]); | |
} | |
return 0; | |
} |
E.14
charのサイズって処理系依存だったっけ?
とりあえずsignedかunsignedかは処理系依存だった。
練習問題14
手抜き
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
char family_name[32]; | |
char first_name[32]; | |
scanf("%s", family_name); | |
scanf("%s", first_name); | |
printf("%s%s\n", family_name, first_name); | |
return 0; | |
} |
ラベル:
9c
登録:
投稿 (Atom)