TaleemBay
Study
UniversitiesScholarshipsFeesDates
TaleemBay

Empowering students with Next-Gen tools for a brighter future. Your one-stop destination for education in Pakistan.

Quick Links

  • Universities
  • Study Center
  • Past Papers
  • Date Sheets
  • Results

Support

  • About Us
  • Contact
  • Privacy Policy
  • Terms of Service
  • Advertise

Contact Us

  • Arfa Software Technology Park,
    Ferozepur Road, Lahore
  • +92 300 1234567
  • hello@taleembay.com

© 2026 TaleemBay. All rights reserved.

Designed with ❤️ for Pakistan

Home
Unis
Study

Study Center

Overview
9th Class10th Class11th Class12th Class

Resources

Past PapersDate Sheets

Need Notes?

AI-powered search for instant answers.

Chapter 13
computer-science • intermediate 12th

Chapter 13: Functions in C

Comprehensive notes for Chapter 13 Functions in C. Covers function definition, declaration, parameters, local vs global variables, and benefits of modular programming.

Function Basics

Definition: A named block of code that performs a specific action. Executed when called by its name.

Benefits:

  • Reusability: Write once, use multiple times.
  • Modularity: Divides complex programs into smaller, manageable parts.
  • Easier Maintenance: Debugging and modifying specific functions is easier than a monolithic program.

Types of Functions

  • Built-in Functions: Part of the C language library (e.g., printf(), scanf()). Ready-made and optimized.
  • User-defined Functions: Created by the programmer to perform specific tasks.

Function Structure

Function Head/Header: First line of definition. Contains Return-type, Name, and Parameters.

Function Body: Block of code inside curly braces {}.

Function Declaration (Prototype): Model of the function, usually written before main(). Ends with a semicolon. Syntax: return_type name(parameters);

Parameters

  • Actual Parameters: Values passed to the function during a function call.
  • Formal Parameters: Variables defined in the function header to receive values.

Variable Scope & Lifetime

  • Local Variables: Declared inside a function. Scope is limited to that function. Created when function starts, destroyed when it ends (automatic lifetime).
  • Global Variables: Declared outside all functions. Scope is the entire program. Created at program start, destroyed at program termination.