err = 処理1(...); if (err != 0) { エラー処理 }
err = 処理2(...); if (err != 0) { エラー処理 }
err = 処理3(...); if (err != 0) { エラー処理 }if (p != 0) { a = *p; }// 普通の書き方.
a = malloc(n);
if (a == NULL) {
fprintf(stderr, "out of memory\n");
exit(EXIT_FAILURE);
}
fp = fopen(argv[1], "rt");
if (fp == NULL) {
fprintf(stderr, "fopen error : %s\n", argv[1]);
exit(EXIT_FAILURE);
}
// 便利な関数がある場合の書き方.
a = malloc_ne(n);
fp = fopen_ne(argv[1], "rt");| コメント | お名前 | NameLink | |