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

  • ภาษาบางภาษา throw exceptions เมื่อเกิดปัญหา C ไม่มี exceptions
  • แทนที่, C function รายงานปัญหาผ่าน return value — status code
  • ผู้เรียกตรวจสอบโค้ดนี้หลังทุก call และตัดสินใจว่าจะทำอะไร

A function returns 0 on success or -1 on failure; the caller checks the code

Handout · ⁨เอกสารประกอบการเรียน⁩

Log in or create account · ⁨เข้าสู่ระบบหรือสร้างบัญชี⁩

IGCSE, A-Level & AP