KEMBAR78
1Principles of Computer PROGRAMMING.pptx
FUNCTIONS IN C
PROGRAMMING
MAWEJJE ALLAN
DEFINE FUNCTION
A function is a block of code designed to perform a specific task.
• Purpose
1. Code Reusability
2. Improved Readability
3. Simplified Debugging
FUNCTION STRUCTURE
COMPONENTS
•Function Declaration
•Function Definition
•Function Call
1. Function Declaration
A statement that tells the compiler about the function
name, return type, and parameters.
int add(int a, int b);
2. Function Definition
•The actual implementation of the function.
int add(int a, int b) { return a + b; }
3.Function Call
Invoking the function to execute its
code.
int result = add(5, 10);
TYPES OF FUNCTIONS
•STANDARD LIBRARY FUNCTION: Provided by
libraries (printf, scanf.)
•USER-DEFINED FUNCTION: Created by the
programmer.
•FUNCTIONS WITH RETURN VALUES:
Functions that do not return a value.
IMPORTANCE OF FUNCTIONS
•Improved Readability
•Simplified Debugging
•Enhanced Maintainability
•Code Reusability
IN CONCLUSION
Functions are essential for organizing code,
enhancing reusability, and making debugging
easier.

1Principles of Computer PROGRAMMING.pptx