FUNCTIONS
A function inC is a block of code that performs a specific task. Instead of
writing the same code multiple times, a function allows code reuse and
improves readability.
3.
SYNTAX OF AFUNCTION
• return_type The data type of the value the function returns. Use void if the function
→
does not return anything.
• function_name The identifier used to call the function.
→
• parameters (arguments) Values passed to the function (optional).
→
• function body The set of instructions the function executes.
→
• return statement Returns a value (optional, required if return type is not void).
→
4.
FUNCTIONS
A function inC is a block of code that performs a specific task. Instead of
writing the same code multiple times, a function allows code reuse and
improves readability.
5.
TYPES OF FUNCTIONS
InC, functions are essential for structuring programs. They are
categorized into:
• System-defined (predefined) functions
• User-defined functions
6.
SYSTEM-DEFINED FUNCTIONS
System-defined functionsare built-in functions provided by C's
standard libraries. They perform common tasks such as input/output
operations, mathematical calculations, string handling, etc.
These functions require the inclusion of the relevant header file before use.