Course Title: C Programming
Course No: BIT102
Nature of the Course: Theory + Lab
Semester: I
Course
Description
This course introduces students to
fundamental programming principles and problem-solving techniques through the
structured programming paradigm using the C programming language. Topics
include program design, basic syntax, operators, control structures, arrays,
functions, pointers, structures, and file handling.
Course
Objectives
The primary goal of this course is to
equip students with the skills to design and implement structured programs to
solve specific problems using C programming. Additionally, it provides a
comprehensive understanding of the syntax and semantics of the C language.
Course
Contents
Unit
1: Introduction (3 Hrs.)
- History and advantages of C
programming.
- Problem analysis, algorithms, and
flowcharts.
- Structure of a C program.
- Writing, compiling, debugging, and
executing C programs in Windows and Unix/Unix-like environments.
Unit
2: Elements of C (3 Hrs.)
- C tokens and character sets.
- Data types, constants, and
variables.
- Expressions, statements, and
comments.
- Escape sequences and delimiters.
Unit
3: Input/Output Functions (2 Hrs.)
- Conversion specifiers.
- Input/output functions.
- Formatted I/O operations.
Unit
4: Operators and Expressions (4 Hrs.)
- Arithmetic, relational, logical, and
assignment operators.
- Increment and decrement operators,
ternary operator, and bitwise operators.
- Other operators: comma, sizeof.
- Expression evaluation, operator
precedence, and associativity.
Unit
5: Control Structures (8 Hrs.)
- Introduction to selection and
iterative statements.
- GOTO and labels.
- Selection Statements: `if`,
`if-else`, `if-else-if` ladder, nested `if`, `switch`.
- Conditional operator.
- Iterative Statements: `for`, `while`,
`do-while`, nested loops, and the odd loop.
- Controlling loops: `break` and
`continue`.
Unit
6: Arrays and Strings (5 Hrs.)
- Introduction to arrays and their
initialization.
- Array indexing and usage.
- One-dimensional and multi-dimensional
arrays.
- Strings and basic string manipulation
functions.
Unit
7: Functions (6 Hrs.)
- Introduction and types of
functions.
- Declaration, definition, and function
calls.
- Arguments and return statements.
- Recursive functions.
- Call by value and reference.
- Variable scope and function
parameters.
- Arrays as function parameters.
- `void` as a parameter.
- External functions and
variables.
- Header files, static variables, and
register variables.
Unit
8: The C Preprocessor (2 Hrs.)
- Features of the C preprocessor.
- Macro expansion and macros with
arguments.
- File inclusion and conditional
compilation.
- Preprocessor directives: `if`, `elif`,
`undef`, and `pragma`.
- The build process: preprocessing,
compiling, assembling, linking, and loading.
Unit
9: Pointers (5 Hrs.)
- Introduction to pointers and their
declaration/initialization.
- Address, reference, dereference, and
`sizeof` operator.
- Null pointers and pointer
arithmetic.
- Pointers as arguments and return
values.
- Pointers vs. arrays.
- Dynamic memory allocation.
Unit
10: Structures and Unions (5 Hrs.)
- Definition and usage of
structures.
- Arrays of structures.
- Passing structures and arrays of
structures to functions.
- Pointers to structures.
- Self-referential structures.
- `typedef` and table lookups.
- Definition and applications of
unions.
Unit
11: File Handling (2 Hrs.)
- Files vs. streams and required header
files.
- Opening and closing streams, open
modes, and the `errno` variable.
- Reading/writing streams using
`fgetc()`, `fputc()`, `fgets()`, and `fputs()`.
- Raw I/O operations: `fread()` and
`fwrite()`.
- Random file access.
Laboratory
Works
Lab exercises will focus on verifying
programming concepts introduced in the course. These include:
- Logic implementation.
- Set operations, relations, and
functions.
- Recursive algorithms.
- Number theory algorithms and
operations on integers.
- Boolean matrix operations.
- Algorithms for graphs and trees.
Text/Reference
Books
1. Let Us C by Yashavant P.
Kanetkar.
2. The C Programming Language by Brian
Kernighan and Dennis Ritchie.
3. Programming with C by Byron
Gottfried, McGraw Hill Education.
This course prepares students to
develop efficient, structured solutions to programming challenges, providing a
strong foundation in C programming.