C Programming

02.03.01, Mathematics and Artificial Intelligence



You have a lecturer from the Department of Software Engineering, but probably have not yet completed the survey 'Let's get acquainted'? This is a very dangerous situation. Don't wait for (and if) the instructor to say. Fill in!


Distant Classes

  • MS Teams team code: k1rhg4k



0. Git repository

  1. Hello, World!

  2. Number guess. You should define a range, e.g. 1 to 1000. The program should ask user to think of a number. Then the program should ask the user repeatedly if the number is greater than some X, than Y, etc. until it guesses a number. Then it should print the number out. Note that you are free to decide if to split your range by 2 each time or widen it to the power of 2 first, and the program should always ask the same question like 'is is greater than X', but, if you do not like asking about greater you can ask about 'less than X' — it will finally make no difference =).

  3. Change 04.Arrays_Strings/arrays2.c (or arrays3.c if you have large CPU cache) a tiny bit to slow it down dramatically by causing a cache thrashing.

  4. Reproduce string input overflow in 04.Arrays_Strings/string_overflow.c. Fix it by any mean (like you saw during classes or other means).

  5. Starting from 05.Pointers/pointer3.c in examples, calculate a room for all the command line arguments, then concatenate them and print as a single string.

  6. Port 06.Structs_Unions/floating_fields.c example for double precision floating point numbers.

  7. Basing on 07.Modules (.win or .unix) and your previous tasks create any two programs, which use shared object or statically linked shared module.

  8. Get inspired by 09.Tools/ exaple and create a proper makefile for any of your multi-module program. Using makedepends for header dependency scan and creating IDE projects are possible, but not required.

  9. Finish 08.IO/binary.c to not only write, but also read binary data from a file.

  10. Linked list: implement missing functions in 10.List/list.c, add some code to prog.c to test them.

Agenda Draft

  1. C Programming language reasoning and history. Operating enviroment: generic Unix-like (Linux), others (Windows + Cygwin,MSYS2,MSVC). 'Hello World' program.

  2. Built-in data types: char, int, float, double. Control flow: operators, functions, comments, cycles.

  3. Macros. Arrays and strings. Pointers. Character encodings.

  4. Structures and unions. Bit fields.

  5. Module system. Includes. Libraries.

  6. Input and output. Standard library modules.

  7. Utilities: 'make'; IDEs; CI/CD; debuggers; profilers.

  8. Dynamic memory allocation, heap. Memory leaks.

  9. Sorting and searching arrays.

  10. Trees and graphs.

  11. C and Python. CFFI, Python.h.

  12. pkg-config. Cross-compiling C programs.


  1. Ivor Horton. Beginning C. From Novice to Professional. APress: 2006.

  2. Jeri N. Hanly, Elliot B. Koffman. Problem Solving and Program Design in C. Pearson Education: 2007.

  3. Kyle Loudon. Mastering Algorithms with C. O'Really: 1999.

  4. Brian W. Kernighan, Dennis M. Ritchie. The C Programming Language. Prentice Hall: 1988

  5. Cay S. Horstmann. Windows Shell Tutorial

  6. Scott Chacon, Ben Straub. Pro Git Book

C Programming 2022