Logo

BIT C Programming

bitsemester 1

C Programming

Subject Code: BIT102

Course Title: C Programming

Course No: BIT102

Nature of Course: Theory & Practical

Full Marks: 100

Pass Marks: 40

Credit Hours: 3

Course Description

This course familiarizes students with basic principles of programming. It introduces structured programming paradigm using a high level language called C. It covers the concept of problem solving techniques, program design, and basic elements of C along with the detailed concept of operators, statements, arrays, functions, pointers, structures and file handling.

Course Objective

The main objective of this course is to acquaint the students with good program design through structured programming paradigm for developing program for specific tasks using C Programming Language as well as to present the syntax and semantics of the C language.

Course Contents

Unit 1: Introduction (3 Hrs.)

History and Advantages of C, Problems Analysis, Algorithm and Flowchart (introduction and characteristics of algorithm, introduction and symbols of flowchart start/stop, read/print, processing statement, condition check, direction of flow), Structure of a C Program (preprocessor directive, #include and #define directives, header files and library files); Writing, compiling, Debugging, Executing and\ Testing a C Program in windows and Linux/Unix like environment (compiler, integrated development environment, compiling and linking, compiler error, linker error, and run-time error)

Unit 2: Elements of C (3 Hrs.)
C Tokens (keywords, identifiers, operators, constants, and special symbols); C Character Sets (letters, digits, special characters and white spaces); Data types (Basic, Derived, and User Defined), Constants and Variables; Expression, Statements and Comments; Escape sequences and Delimiters

Unit 3: Input/output Functions (2 Hrs.)
Conversion Specifiers; I/O functions; Formatted and Unformatted I/O (sacanf, printf, getchar, putchar, getch, getche, gets, puts, putch, getc, putc)

Unit 4: Operators and Expressions (4 Hrs.)
Arithmetic operators; Relational operators; Logical operators; Assignment operators; Type conversion in assignment; Increment and decrement operators;Ternary operator (conditional operator); Bitwise operator; Other operators (comma, sizeof); Expression evaluation (implicit and explicit type conversion; Operator precedence and associatively)

Unit 5: Control Structures (8 Hrs.)
Introduction control statements, Selection statements: if, if..else, if..else if ladder, nested if, switch case; break and continue, goto and labels Iterative statement: For Loop, While Loop, Do while Loop, Nested Loop; The odd loop; Controlling the loop execution, Exit statement

Unit 6: Arrays and Strings (5 Hrs.)
Introduction to Arrays; Initializing Arrays; The meaning of array indexing; One dimensional and Multidimensional Arrays (two dimensional only); String and Basic functions dedicated to string manipulation (reading and writing strings, null character, strcpy, strcmp, strcat, strlen, strupr, strlwr, strrev)

Unit 7: Functions (6 Hrs.)
Introduction and types of functions; Declaring, Defining and Calling functions; Arguments and Return Statement; Recursive functions; Function call by value and reference; Variables' scope, local variables and function parameters; Arrays as function parameter; Void as a parameter; Parameterizing the main function; External function and variables; Header files; Static variables; Register Variables

Unit 8: The C Preprocessor (2 Hrs.)
Features of C Preprocessor; Macro Expansion; Macros with Arguments; Macros versus Functions; File Inclusion; Conditional Compilation; #if and #elif Directives; #undef Directive; #pragma Directive; The Build Process; Preprocessing; Compiling; Assembling; Linking; Loading

Unit 9: Pointers ( 5 Hrs.)
Introduction of Pointers, declaration and initialization of pointer variables; An address, a reference, a dereference and the sizeof operator; Pointer to nothing (NULL); Pointer assignment; Pointer Arithmetic; Pointer as argument and Pointer as return values; Pointers vs. arrays; Dynamic memory allocation

Unit 10: Structure and Unions (5 Hrs.)
Definition of Structure; Array of structures; Passing structure and array of structure to function; Pointers to structures and arrays of structures; Self-referential structures; Typedef; Table Lookup; Unions

Unit 11: File Handling (2 Hrs.)
Files vs. streams; Header files needed for stream operations; Opening and closing a stream, open modes, errno variable; Reading and writing to/from a stream; Predefined streams: stdin, stdout and stderr; Stream manipulation: fgetc(), fputc(), fgets() and fputs() functions; Raw input/output: fread() and fwrite() functions; Random access to files

Text Books

1. Let Us C, Yashavant P. Kanetkar
2. Brian Kernighan and Dennis Ritchie, The C Programming Language
3. Byron Gottfried, Programming with C, McGraw Hill EducationReference Books:

Reference Books

1. Let Us C, Yashavant P. Kanetkar
2. Brian Kernighan and Dennis Ritchie, The C Programming Language
3. Byron Gottfried, Programming with C, McGraw Hill EducationReference Books:

Lab Works

C Programming is the first programming course in BIT program. It builds the foundation on how to
write a program using any high level language. This course is responsible for building the capability
in students regarding development of good logic building and program which is essential throughout
the BIT course and thereafter. Hence, Laboratory Works in this course emphasizes the verification of
programming concepts learned in class. Each unit should include sufficient practical lab exercise.
Further, 20% of the total marks is obtained from the practical. Students must spend 45 hours in lab
activities with supervision of instructor.
Some important contents that should be included in lab exercises are as follows:

Unit 1,2,3,4:
Using different data types available in C, perform arithmetic operations in C, perform
formatted and unformatted input/output operations, perform character input/output operations.
Using relational operator, logical operator, assignment operator, ternary operator, and other
operators. Evaluation of Expression to check operator precedence and associatively.


Unit 5:
Create decision making programs using control statements like; if, if..else, if..else ladder,
nested if, and switch cases.
Create programs using loops (for, while, do while, nested loops) and realize the differences
between entry controlled and exit controlled loops.


Unit 6:
Create, manipulate arrays and matrices (single and multi-dimensional), manipulate strings
(character arrays) using various string handling functions.


Unit 7:
Create user-defined functions with/without parameters or return type, create recursive
functions, use function call by value and call by address, work with automatic, global and
static variables.


Unit 8:
Create programs to address macro, file inclusion, conditional compilation (#if, #ifdef, #endif,
#ifndef, #else, #elif), building process

Unit 9:
Create programs that addresses pointer arithmetic, pointers and arrays, pointer and character
strings, pointers and functions, pointer and structure, and dynamic memory allocation.


Unit 10:
Create and use simple structures, array of structures, nested structure. Passing structure and
array of structure to function, concept of pointer to structure


Unit 11:
Create files that address random access and input/output operations in file, create files to keep
records and manipulation of records etc.
Note: Students should be encouraged to create small project work integrating all of the above
concepts.