Skip to content · ⁨ข้ามไปยังเนื้อหา⁩

Functions, parameters, and return values · ⁨ฟังก์ชัน, พารามิเตอร์, และค่าที่ส่งกลับ⁩

English

Why functions

  • A function is a named piece of work. You write it once and call it whenever you need it.
  • Functions keep programs short and clear, and let you build big jobs from small ones.
  • You have already used printf — a function from <stdio.h>. Now you write your own.
ไทย

เหตุผลที่ต้องใช้ฟังก์ชัน

  • ฟังก์ชัน คือชุดคำสั่งที่มีชื่อ คุณสามารถเขียนไว้หนึ่งครั้งแล้ว เรียกใช้ เมื่อต้องการ
  • ฟังก์ชันช่วยให้โปรแกรมสั้นและเข้าใจง่าย รวมถึงช่วยสร้างงานใหญ่จากส่วนย่อยๆ ได้
  • คุณเคยใช้ printf ไปแล้ว — ซึ่งเป็นฟังก์ชันจาก <stdio.h> ตอนนี้คุณมาเขียนของตัวเอง

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

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

IGCSE, A-Level & AP