Introduction to Programming

Material


Slides
Introduction to UNIX-like systems
C – basics (variables, operators, flow control, loops) updated: 28.08.23
money-in-boxes.c
student-data.c
Test cases for problem 4
C – input/output (Part I) getc-input.txt
common.h, basic-io.c, robust-scanf.c,   updated: 25.08.23
C – arrays   updated: 04.09.23 strcpy.c
C – pointers updated: 08.09.23 large-vlas.c
C – functions updated: 10.09.23 array-args.c, multi-dim-arrays.c
C – structures
C preprocessor
C – input/output (Part II)
C – function pointers


Python – getting started gcd.c   gcd.py
money-in-boxes.py
random-simulation.c

Exercises, tests, etc.

Pending questions

  1. Mismatch between conversion specifier and argument for printf. See print-typeX-as-typeY.c.
    1. The output of Part A is deterministic. As an exercise, try to explain / understand the output in terms of the IEEE 754 floating point format.
    2. The output of Part B is also deterministic. You should be able to explain / understand most of the output.
    3. The output of Part C appears to be non-deterministic. I am looking for an explanation why this is so.
  2. Why do large variable length arrays cause problems? See large-vlas.c above. Is this documented in the C standard or a limitation of gcc's implementation?

Other resources


Last modified: Mon Oct 30 13:52:26 IST 2023