Logo

BITM Structured Programming

bitmsemester 2

Structured Programming

Subject Code: IT213

Course Title: Structured Programming

Course No: IT213

Nature of Course: Theory & Practical

Full Marks: 60 + 40

Pass Marks: 30 + 20

Credit Hours: 3

Course Description

Introduction to the C Language, Data Types and Variables, Input/Output Management, Expressions and operators, Selection statements, Loops, Arrays, Modular Programming with Functions, Pointers and Strings, Structures and Dynamic Memory Allocation, The Preprocessor, and File Input/Output

Course Objective

This module aims to introduce students to the discipline of computing with a focus on good program design, programming styles, and structured program development using a high-level programming language. The students shall also be introduced to the basic concepts in procedural abstraction, structured programming and top-down design with stepwise refinement. Laboratory work is essential in this module.

Course Contents

Course Contents Teaching Methodology Teaching Hours
Unit 1: Introduction to the C Language (3 Hrs.)
The C Language and its Advantages Lecture/Lab
The Structure of a C Program, Writing C Programs, Debugging a C Program
Examining and Running a C Application Program
Unit 2: Data Types and Variables (3 Hrs.)
Data Types (integer, floating, character, type conversion, type definitions, sizeof operator) Lecture/Lab
Unit 3: Input/Output Management (3 Hrs.)
Input/Output Management: printf(), scanf() Lecture/Lab
Conversion specifiers
Escape sequences
Unit 4: Expressions and operators (5 Hrs.)
Arithmetic operators: operator precedence and associativity Lecture/Lab
Assignment operators
Increment and decrement operators
Expression evaluation
Expression statements
Relational operator, logical operator, arithmetic assignment
Unit 5: Selection statements (4 Hrs.)
Logical expressions Lecture/Lab
If statement
Switch statement
Unit 6: Loops (4 Hrs.)
While Lecture/Lab
Do..while
For
Exiting from a loop (break, continue, goto)
Unit 7: Arrays (3 Hrs.)
One-dimensional array Lecture/Lab
Multidimensional array
Unit 8: Modular Programming with Functions (4 Hrs.)
Defining and calling functions Lecture/Lab
Function declarations
Arguments
Return statement
Program termination (exit function)
Unit 9: Pointers and Strings (4 Hrs.)
Pointer variables Lecture/Lab
The address and indirection operators
Pointer assignment
Pointer as argument
Pointer as return values
Pointer Arithmetic
Using pointers for array processing
String literals, variables
Reading and writing strings
Using the C string library: strcpy, strlen, strcat, strcmp
Arrays of strings
Unit 10: Structures and Dynamic Memory Allocation (4 Hrs.)
Structures, Arrays of Structures Lecture/Lab
Passing Structures to Functions
Nested Structures
Unions
enumerations
Dynamic Memory Allocation (malloc, calloc, realloc)
Deallocating storage
Linked list (-> operator, creating, displaying, searching)
Unit 11: The Preprocessor (4 Hrs.)
How the preprocessor works Lecture/Lab
The C Preprocessor and the #include and #define Directives
Macro definitions (simple, parameterized macros), general properties of macros
#if and #endif directives
The defined operator
Unit 12: File Input/Output (4 Hrs.)
Streams: file pointers, standard streams and redirection, text files versus binary files Lecture/Lab
File operations: opening a file, modes, closing a file, attaching a file to an open stream, obtaining file names from the command line
File Input and Output, reading/writing data, structure to files, random access

Text Books

1. K. N. King, K.N. King, C Programming: A Modern Approach, W W Norton & Co Inc (February 1996)
2. Brian W. Kernighan, Dennis M. Ritchie, C Programming Language, 2nd Edition Prentice Hall; 2 edition (April 1, 1988)

Reference Books

1. David Griffiths, Dawn Griffiths, Head First C, O'Reilly Media; 1 edition (April 19, 2012)
2. Clovis L. Tondo (Author), Scott E. Gimpel (Author), "The C Answer Book: Solutions to the Exercises in 'The C Programming Language,' Second Edition", Prentice Hall; 2nd edition (November 11, 1988)
3. Peter van der Linden, Expert C Programming: Deep C Secrets, Prentice Hall; 1st edition (June 24, 1994)