Skip to content · ⁨コンテンツへスキップ⁩
English

C has no try/except

  • Some languages throw exceptions when something goes wrong. C does not have exceptions.
  • Instead, a C function reports trouble through its return value — a status code.
  • The caller checks that code after every call and decides what to do.

日本語

C には try/except がない

  • 一部の言語ではエラー発生時に例外をスローしますが、C には例外机制がありません。
  • その代わりに、C の関数は返り値——ステータスコード——を通じて問題報告を行います。
  • 呼び出し側はすべての呼び出し後にこのコードを確認し、適切な対応を決定します。

関数が成功時は 0、失敗時は -1 を返します。呼び出し側はコードを確認します

Handout · ⁨プリント⁩

Log in or create account · ⁨ログインまたはアカウント作成⁩

IGCSE, A-Level & AP