Introduction to Programming

The computer is often a very handy tool when solving complex technical problems in engineering and scientific explorations. Programming a computer is a fundamental task in finding solutions to such problems.

Objectives

This course is being offered in order to train the undergraduate students in IIT Madras (from various engineering and science departments) in the fundamentals of programming. The course aims to provide exposure to problem-solving through programming. It aims to train the student to the basic concepts of the C-programming language. This course involves a lab component which is designed to give the student hands-on experience with the concepts.

Important Links

Learning Outcomes

After the course the students are expected to be able to (this is what the exams will test) :

  • Identify​ situations where computational methods and computers would be useful.
  • Given a computational problem, identify and abstract​the programming task involved.
  • Approach​ the programming tasks using techniques learned and write​ pseudo-code. Choose​ the right data representation formats based on the requirements of the problem.
  • Use​ the comparisons and limitations of the various programming constructs and choose​ the right one for the task in hand.
  • Write ​the program on a computer, edit, compile, debug, correct, recompile and run it.
  • Identify ​tasks in which the numerical techniques learned are applicable and apply them to write programs, and hence use ​computers effectively to solve the task.

Syllabus (4 modules):

Module 1 : (Introduction to Computing) - 6 lectures

= Fundamentals of Computing, Historical perspective, Early computers. Computing machine. Problems, Pseudo-code and flowcharts. Memory, Variables, Values, Instructions, Programs.

Module 2 : (Introduction to C) 10 lectures

  • The language of C : Phases of developing a running computer program in C. Data concepts in C :Constants, Variables, Expressions, Operators, and operator precedence in C.
  • Statements : Declarations, Input-Output Statements, Compound statements, Selection Statements. Conditions, Logical operators, Precedences. Repetitive statements, While construct, Do-while Construct, For construct.
  • Data types, size and values. Char, Unsigned and Signed data types. Number systems and representations. Constants, Overflow.
  • Arrays. Strings. Multidimensional arrays and matrices.

Module 3 : (Modular Programming and Example Problems) ​: 10 lecture

  • Functions :The prototype declaration, Function definition.
  • Function call : Passing arguments to a function, by value, by reference. Scope of variable names. Recursive function calls, Tail recursion. Analysing recursion, - Tree of recursion, linear recursion.
  • Sorting problem : Selection Sort, Insertion Sort, Comparison between sorting algorithms. Sorting in multidimensional arrays. Sorting in strings.
  • Search problem : Linear search and binary search. Comparison between search procedures. Recursive and Iterative formulations.

Module 4 : (More Data Types in C) 14 lectures

  • Pointers : Pointer variables. Declaring and dereferencing pointer variables. Pointer Arithmetic. Examples. Accessing arrays through pointers. Pointer types, Pointers and strings. String operations in C.
  • Structures in C : Motivation, examples, declaration, and use. Operations on structures. Passing structures as function arguments. type defining structures.
  • Self-referential structures. Dynamic Data Structures. Linked Lists. Examples.
  • File input-output in C. Streams. Input, output and error streams. Opening, closing and reading from files. Programming for command line arguments.
  • Numerical errors due to data representations and machine precision. Approximation and error analysis. Illustration through examples.

Course Textbooks :

  • C: How to program, H. M. Deitel, P. J. Deitel, 7th edition, Pearson Education, 2010.

References Textbooks :

  • R. G. Dromey, “How to Solve It By Computer”, Pearson, 1982
  • A.R. Bradley, “Programming for Engineers”, Springer, 2011
  • Kernighan and Ritchie, “The C Programming Language”, (2nd ed.) Prentice Hall, 1988