Skip to content

W4RH4WK/UIBK-703004-C-Programming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction to C Programming 2016

This repository is intended for groups 4 and 5, and is not essential for completing this course. All files provided are simply here to support your learning experience.

This stuff may not always be in line with the lecture, discretion is advised.

What you should know by now

This list will be extended over time and serves as a checklist for stuff you should know. Some of these bullets are not handled by the lecture, it is your responsibility to learn them on your own.

Linux / Shell

Basically everything taught in the Brückenkurs (see references). The more you know about the system you are using, the better. Understanding how components (kernel, operating system, programs, shell, networks, ...) interact is key.

  • File system hierarchy: ls / pwd / cd / mkdir / cp / mv / rm / touch
  • Viewing: cat / less / head / tail / df / du
  • Finding things: find / grep / whereis / whoami
  • Getting help: apropos / man / info / file / which / type
  • Permissions: chmod / chown
  • Archives: tar / zip / unzip / xz / gzip / gunzip
  • Environment variables / export / unset
  • Executing binaries / $PATH
  • Hidden files / ls -l / ls -a
  • Exit code of a command: $?
  • IO redirect: < / > / << / >> / <<< / 2> / 2>&1 / |
  • Managing your software / package management

Technical Stuff

  • What is the purpose of a compiler
  • Typical stages of a compiler
  • Calling gcc with additional flags (C standard, enables warnings)
  • Process memory layout

Makefile

  • Defining and using variables
  • Defining and invoking rules
  • Why .PHONY is needed
  • What target is build by default
  • How to build a specific target
  • Dependencies (prerequisites) of a target
  • Purpose of the targets all and clean
  • Forcing a rebuild of a target by passing -B
  • Predefined variables like $(CC) and $(RM)

C Programming

  • Hello World example
  • Variables / Types
  • Arithmetic / Conditionals / Overflows / Casts
  • if / else / switch
  • while / for / do while / continue / break / goto
  • enum / const / #define
  • Basic IO: printf / puts / putchar / scanf / getchar
  • struct / union / Bit fields
  • Functions: Signature / Declaration / Definition / Recursion / call-by-value / call-by-reference / pure (side-effect free) / tail-recursion / stack-frames (see 07_where_goes_my_stuff)
  • Arrays / Multi-dimensional Arrays / Strings
  • Pointer / Pointer arithmetic / void*
  • Global variables / Scope / static local variables
  • Dynamic memory management / malloc / free / valgrind
  • Using modules / static / extern / header guards
  • IO / buffering
  • Double linked list / single linked list / queue.h
  • Preprocessor magic

Don't Panic!

Sooner or later you will run into problems, follow these bullets:

  1. find problem
  2. isolate problem
  3. understand problem
  4. fix problem
  5. verify fix

Getting Help

  1. from the commandline: use tools like apropos and man to get information about general commands, functions, system calls, config files, etc.

  2. read the fucking manual: if you run into problems consider reading the manual or provided documentation before moving on.

  3. Google is your friend: Google can help you out even when the documentation can not. People might have run into the same problem as you. You may use other search engines, just stay away from Bing.

  4. IRC / forum / mailing list / bug tracker / email: neither the manual nor Google helped you solving the problem? Take a step back and revisit the facts and what you have already discovered in relation to the problem. Now you are pardoned to get in contact with somebody. A recommended approach is asking in the related IRC channel or forum.

  5. provide information: Most importantly, provide the necessary information. Add log files and similar info dumps to your question, otherwise people won't be able to help you. Be precise and state whether you talk about facts or presumptions.

References

Reference System

I'll use a virtualized, updated Ubuntu 16.04 LTS (64 Bit) as reference system. But you don't have to mimic this, hardly anything we do in this course is system specific. All modern GNU/Linux operating systems should behave similar to our doings.