بطبط

رجع لباقي المحاضرات
محاضرة 9

Functions I

Introduction to modular code and user-defined functions.

يلا نشوف الملخص

Lecture 9 Summary: Function Fundamentals

1. The Importance of Functions

  • Modularity: Functions allow programmers to divide a large program into smaller, manageable parts.
  • Code Reuse: They prevent the need to repeat the same piece of code in multiple places.
  • Readability: Programs become cleaner and easier to understand when logic is organized into functions.

2. Internal vs. External Functions

  • Internal (User-Defined): Created by the programmer to solve specific tasks.
  • External (Built-in): Functions grouped in specialized libraries like <iostream>, <cmath>, or <cstdlib>.

3. Function Workflow

  • Include Statement: Necessary libraries must be included first.
  • Function Prototype (Declaration): Written before main() to tell the compiler the function's name, return type, and parameters.
  • Main Function: Where the program starts and where functions are typically "Called".
  • Function Definition: The actual code block (body) that executes the task.

4. Syntax and Components

  • Return Type: Indicates the type of value returned (e.g., int, double). Use void if the function returns nothing.
  • Parameters: Placeholders defined in the function header to receive data.
  • Arguments: The actual values passed to the function during the call.
  • Return Statement: Used to send a result back to the caller.

في نقطة مش واضحة؟ بطبط موجود!

اسأل بطبط عنها
بطبط
</>تم التصميم والتنفيذ بقسم تكنولوجيا المعلومات
تحت إدارة وإشراف

جامعة برج العرب التكنولوجية

جميع الحقوق محفوظة © BATBAT 2026

Powered withbyبطبط© 2025