Logo

BITM Structured Programming in C

bitmsemester 1

Structured Programming in C

Subject Code: ITM 102

Course Title: Structured Programming in C

Course No: ITM 102

Nature of Course: Theory & Practical

Full Marks: 60

Pass Marks: 30

Credit Hours: 3

Course Description

This course introduces students to the concepts of structured programming using C language. Students learn to write efficient, modular, and reusable code using variables, data types, control statements, functions, arrays, pointers, structures and unions, and file handling. The course emphasizes both theoretical understanding and practical application through hands-on coding exercises and projects. Upon completion, students will be able to design, develop, test, and debug programs effectively and will be prepared to advance to higher-level programming languages and software development courses.

Course Objective

By the end of this course, students will be able to Understand the basic concepts of programming languages and the structure of C programs. Demonstrate knowledge of C programming fundamentals, including syntax, data types, operators, and expressions. Write and execute C programs using various programming constructs such as decision-making, looping, and functions. Apply structured programming principles to design modular and efficient programs. Utilize arrays, strings, pointers, and structures for solving computational problems. Implement file handling and dynamic memory allocation for real-world applications. Develop logical problem-solving skills to design and implement real-world solutions using the C language.

Course Contents

Course Contents Teaching Methodology Teaching Hours
Unit 1: Introduction to Programming Language (7 Hrs.)
Definition of programming language Lecture/Lab
Importance of programming in computing
Types of programming languages
Programming Approach: Concept and definition of Top-Down Approach and Bottom-Up Approach
Algorithm (Definition and characteristics, Basic Operations of an Algorithm with example)
Flowchart (Definition and symbols used, Guidelines for flowcharting, Conversion of algorithm to flowchart, Basic Operations of a flowchart with examples)
Unit 2: Basic Elements of C (6 Hrs.)
C Standards Lecture/Lab
Features of C
Structure of a C program
compilation and execution
Character Set
C Tokens (Keywords, Identifiers, Constants, Strings, Operators, Delimiters)
Data Types
Escape Sequences
Variables, Constants (Literal Constants and Symbolic Constants)
Writing Comments
Expressions and Statements
Preprocessor Directives
Arithmetic Operators
Unary Operators
Relational and Logical Operators
The Comma Operator
Assignment Operators
The Conditional Operator
Size of Operator
Operator Precedence and Associativity
Unit 3: Data Input and Output (3 Hrs.)
Introduction Lecture/Lab
Single Character Input and Output
The printf() and scanf() Functions
Conversion Characters
Formatted and Unformatted I/O
Unit 4: Control Statements (6 Hrs.)
Introduction to simple and compound statement Lecture/Lab
Sequential statement
Branching statement (Simple if statement, if-else statement, Nested if-else statement, else-if ladder, switch statement, go to statement)
Looping statement (for loop, while loop, do while, Nested loop)
Loop interruption (break, continue)
Unit 5: Functions (5 Hrs.)
Introduction to function Lecture/Lab
Advantages of function
Types of Function (Built-in and user defined function)
Elements of user-defined function (Function definition, Function prototype, Function parameters)
Scope rules (Global Variables and Static Variables)
Category of User defined functions (Functions with no arguments and no return values, Functions with arguments and no return values, Functions with arguments and return values, Functions with no arguments and return values)
Recursive functions
Function call by values and reference
Unit 6: Arrays and Strings (5 Hrs.)
Defining and Processing Arrays Lecture/Lab
Types of Arrays: Single dimensional and Multidimensional
Array Initialization
Passing Arrays to Functions
Character Arrays
Strings
String Definition
NULL Character
String Initialization
Reading and Writing Strings
Processing Strings
Passing Strings to Functions
Library Functions for String Handling
Unit 7: Pointers (5 Hrs.)
Basics of Pointer Lecture/Lab
The & and * Operators
Pointer Declaration
Pointer Arithmetic
Pointers and Arrays
Dynamic Memory Allocation (malloc, calloc, free, realloc)
Operations on Pointers
Array of Pointers, Passing and Returning Pointers to/from a Function
Unit 8: Structures and Unions (5 Hrs.)
Defining a structure Lecture/Lab
Declaring and accessing structure elements
Initializing structure
Array of structure
Pointer within structure
Structure within structure
Array within structure
Passing and returning structures to/from function
Unions
Comparison between structure and union
Unit 9: File Handling (4 Hrs.)
Introduction to Files, Text and Binary Files Lecture/Lab
File Modes
File Operation (open, read, write, append, close)
Accessing the File sequentially and randomly
Unit 10: Introduction to Graphics (2 Hrs.)
Concepts of Graphics Lecture/Lab
Graphics Initialization and Modes
Introduction to Graphics Function

Text Books

1. Gottfried, B. (2018). Programming with C. McGraw Hill Education.
2. Kelley, A. & Pohl, I. (1998). A Book on C. Pearson Education.
3. Kernighan, K.A. & Ritchie, D.M. (1988). The C programming Language. PHI Publication.
4. Srivastava, S. K. & Srivastava, D. (n.d), Programming in C: In Depth. BPB Publications.
5. Balagurusamy, E. (2019). Programming in ANSI C. TMH publication.
6. Schildt, H. (2000). C: The Complete Reference. Osborne/McGraw-Hill Publication.

Lab Works

The laboratory work includes writing C programs for implementing the concepts of C Tokens and datatypes, Formatted and unformatted Input/output, Branching control structure, Looping control structure, User-defined functions, Array, String handling function, Pointers, Structure and Union, and File handling.