Tuesday, September 29, 2026

(BCA Semester 1 C Language Unit : 5 ) Pointer and File Handling

Unit 5: Pointer and File Handling

Welcome to Unit 5 of C Language – Semester 1, where we explore two powerful and important concepts of C Programming: Pointers and File Handling.

This unit introduces students to the concepts required for direct memory access, dynamic programming, efficient data manipulation, and permanent storage of data using files. The topics are explained in a simple, structured, and practical manner with examples suitable for beginners.

You will begin by understanding the fundamentals of Pointers and how pointers store the memory address of another variable. The unit covers Pointer to Variable, Pointer to Array, Array of Pointers, Pointer to Structure, and Pointers within Structures.

You will also learn how pointers can be passed to User-Defined Functions (UDF) and understand the concept of Pointer to Pointer. The unit further explains the use of pointers in Dynamic Programming and introduces Command Line Arguments, which allow values to be passed to a C program during execution.

The second major part of this unit focuses on File Handling in C. You will learn how files can be used to store data permanently and how C provides various functions for creating, opening, reading, writing, updating, and managing files.

The unit covers important file handling functions such as fopen(), fclose(), fprintf(), fscanf(), fgetc(), fputc(), fseek(), ftell(), rewind(), remove(), rename(), feof(), ferror(), fflush(), and several formatted input/output functions.

📚 In This Unit, You Will Learn:

🔹 Pointers in C

  • 🔹 Introduction to Pointers

  • 🔹 Understanding Memory Addresses

  • 🔹 Pointer to Variable

  • 🔹 Pointer to Array

  • 🔹 Array of Pointers

  • 🔹 Pointer to Structure

  • 🔹 Pointers within Structure

  • 🔹 Passing Pointer to User-Defined Function

  • 🔹 Pointer to Pointer

  • 🔹 Use of Pointers in Dynamic Programming

  • 🔹 Advantages and Applications of Pointers

🔹 Command Line Arguments

  • 🔹 Introduction to Command Line Arguments

  • 🔹 Passing Arguments to a C Program

  • 🔹 Using Command Line Arguments in Programs

🔹 File Handling in C

  • 🔹 Introduction to File Handling

  • 🔹 Concept of Data Files

  • 🔹 Types and Uses of Files

  • 🔹 Opening and Closing Files

  • 🔹 fopen()

  • 🔹 fclose()

  • 🔹 Writing Data using fprintf()

  • 🔹 Reading Data using fscanf()

  • 🔹 Character Input and Output using fgetc() and fputc()

  • 🔹 File Positioning using fseek()

  • 🔹 Finding File Position using ftell()

  • 🔹 Resetting File Position using rewind()

  • 🔹 remove() and rename()

  • 🔹 End-of-File using feof()

  • 🔹 File Error Handling using ferror()

  • 🔹 Flushing File Buffers using fflush()

  • 🔹 String Input/Output using fgets() and fputs()

  • 🔹 Formatted String Functions:

    • sprintf()

    • snprintf()

    • vsprintf()

    • vsnprintf()

  • 🔹 Formatted File Input Functions:

    • fscanf()

    • vfscanf()

  • 🔹 Buffering Functions:

    • setbuf()

    • setvbuf()

  • 🔹 File Input/Output Operations

  • 🔹 File Management and Data Storage

Throughout this unit, students will learn how pointers provide powerful memory-level control and how file handling allows programs to store and retrieve data permanently. Practical examples and programs will help students understand the real-world applications of these concepts.

By the end of this unit, students will be able to declare and use pointers, work with pointers and arrays, structures and functions, understand pointer-to-pointer concepts, use command line arguments, and perform file operations such as reading, writing, updating, and managing files.

This unit completes the fundamental concepts of C Programming and provides a strong foundation for advanced topics such as Dynamic Memory Allocation, Data Structures, Linked Lists, System Programming, and File-Based Applications.

🎓 This Study Material is Useful for:

🎓 BCA Semester 1 Students
🎓 MCA Beginners
🎓 B.Sc. IT / Computer Science Students
🎓 C Programming Beginners
🎓 Programming Logic Beginners
🎓 Computer Science Beginners
🎓 Students Preparing for University Examinations
🎓 Competitive Exam Preparation


























 

⭐ About Ruparel Education

Ruparel Education Pvt. Ltd., Junagadh has been providing quality education and professional computer training for more than 27 years. Our mission is to help students build strong technical skills through practical learning, industry-oriented courses, and expert guidance.


Prepared & Compiled By

Mr. Uday Shah

Head of Information Technology (HOD–IT)
Ruparel Education Pvt. Ltd., Junagadh

Assistant Professor
Faculty of Computer Applications
Noble University

🌐 Blog: https://uday-shah.blogspot.com

© 2026 All Rights Reserved.