Modern C Programming

Course in modern C based on the new standard C11

Even though the language C was created in the beginning of the 70'th it still is the natural choice for machine-level programming. This course will teach you everything you need to know to get started and be productive in C regardless if the target system is a Arduino, Raspberry PI or a usual PC.
This is what you will learn
  • Basic syntax of modern C
  • Understand and know how to deal with pointers
  • Create linked data types
  • Handle native text strings in a safe way
  • Dealing with text files
  • Build C applications
  • Create and link to archive files
  • Debug C programs
  • Search for memory leaks
  • Handle binary record oriented files
  • Handle dates, time-points and format them
Course Contents

Background and Overview

  • K&R C
  • ANSI C
  • C99
  • C11
  • Language properties
  • Overview of the syntax

Scalar Types

  • Integral types
  • Floating-point types
  • Boolean values
  • Characters
  • Type variations, such as short/long, signed/unsigned
  • Variables
  • The sizeof operator
  • Scopes

Operators

  • Arithemtic operators
  • Relational operators
  • Logical operators
  • Assignment expression operators
  • Increment & decrement operators
  • Type alias
  • Type casts
  • The address operator
  • Printing to the console
  • Reading from the console

Composite Types

  • Structs
  • Unions
  • Arrays
  • Text strings

Statements

  • If statements
  • While loops
  • For loops
  • Foreach loops
  • Switch statements

Functions

  • Function syntax
  • Specification vs. implementation
  • Function main()
  • Understanding exit codes
  • Command-line arguments
  • Global vs. local data
  • Usage of static variables and their meaning

The Pre-Processor

  • Including application files
  • Including system files
  • Constants
  • Pre-defined constants
  • Function macros
  • Conditional compilation
  • Include guards
  • Stringification
  • Name concatenation
  • Variadic macros
  • Assertions

Understanding Pointers

  • What is a pointer
  • Pointer declaration syntax
  • The dereferencing operator
  • Starred pointers
  • Pointer arithmetics
  • Array access
  • Why arrays and pointers are the same
  • Text strings are arrays of characters
  • Struct access
  • Understanding the address operator
  • Pointer to a function
  • Indirect function calls

Dynamic Memory Blocks

  • What is dynamic memory
  • Using malloc() and free()
  • Why calloc() is better than malloc()
  • Using realloc()
  • Understanding briefly the structure of the system heap
  • Memory block manipulating functions
  • Linked list data-types
  • Binary-tree data-types
  • Allocating data on the call-stack using alloca()

Machine-Level Support

  • Bit-oriented operators
  • Shift operators
  • Bit-field structs
  • Inline ASM (assembler) code

Standard Libray

  • Overview
  • Online documentation

Working with Text String

  • Understanding that string literals are read-only
  • Overview of string manipulating functions in the standard library
  • Character oriented functions
  • String oriented functions
  • Conversion functions
  • Allocating memory blocks for strings
  • Copying strings
  • Searching strings
  • Tokenization of strings

Working with Files

  • Opening files
  • File opening modes
  • Formatted writing
  • Formatted reading
  • Changing the read/write position in a file
  • Line-oriented reading
  • Byte-oriented read/write

Working with Date & Times

  • The UNIX Epoc
  • Timestamps
  • Using struct tm
  • Getting the currect time
  • Formatting date and time values

Building C Applications

  • Program organization
  • Understanding compilation units
  • Compilation steps
  • Useful GCC compiler options
  • Dynamic vs. static linkage
  • Creating static linked library file (*.a)
  • Creating dynamic linked library file (*.so)

Dealing with Errors

  • Compiling for a debugger
  • Debugging inside CLion
  • Bried about the command-line debugger GDB
  • Finding memory-leaks using Valgrind

Unit Testing

  • What is unit testing
  • Installing cUnit
  • Writing tests
  • Compiling and linking tests
  • Executing tests
Facts
NameModern C Programming
Duration4 Days
Level Beginner
AudienceTechnical programmers
Prerequisitesfa asdf a sd
Tools
  • GCC compiler
  • Jetbrains CLion IDE
  • Ubuntu Linux @ VirtualBox or WSL @ Windows-10
Price24 000 kr + moms 24000
Course Dates
DatePlace
Loading course dates...
Same-Company Discout

We offer a 20% discount for additional participants from the same company and at the same course date. Read more here.

On-Site Course

If you order an On-Site course, we will come to you and hold the course in your office. The price is determined by our price model and is based on the number of course days, number of participants and any travel and lodging.

Read more about out price modell and term of sales here.

Related Courses
CourseDaysLevel
POSIX Threads using C2AdvancedShow
Linux Systems Programming using C3AdvancedShow
Basic course in Modern C++5Beginner Show