Programming in C Language – Advanced Concepts

Course code: CLPL01

Duration:       50 Hours

This course provides a thorough knowledge on advanced programming techniques, including the library functions and the usage of the pre-processor. Knowledge of C is highly marketable for summer internships, research oppurtunity program, and full-time positions in software and embedded systems development.

Audience

Those who have a need to learn and apply C programming techniques.

Prerequisites

This course assumes a prior understanding of basics of programming in C Language.

Objective

To be proficient in:

  • Continue development of C programming abilities by coding a variety of C programs.
  • Deepen understanding of variable attributes such as local, global, external and static.
  • Develop proficiency that perform file and interactive I/O.
  • Gain an understanding of how C implements data structures.
  • Learn and implement debugging methods and hints.
  • Write small applications that "brings together" the knowledge and skills acquired in this course.

Education Criteria

None

1. About this Course

  • Course Objectives
  • Course Overview
  • Suggested References

2. Evolution of C – from past to eternity

  • Objectives
  • milestones: ANSI C, C89, C95, C99, C11
  • obsolete (but still valid) language elements
  • how have function declarations changed over time?
  • trigraphs and digraphs
  • new C11 keywords:
    • _Noreturn
    • _Alignof and _Alignas
    • _Bool
    • _Exit
    • _Complex
    • _Pragma, _ _func_ _
    • _Generic
  • Exercises

3 Handling variable number of parameters ()

  • Objectives
  • calling conventions, passing parameters, stack usage, stack frame, returning a value, recursion
  • va_start()
  • va_arg()
  • va_end()
  • va_copy()
  • vsprintf(), vprintf(), vfprintf()
  • vscanf(), vsscanf(), vfscanf()
  • (_ _VA_ARGS_ _)
  • Exercises

4. Low level IO ()

  • Objectives
  • POSIX, API, ABI, WINAPI, etc.
  • access()
  • open()
  • errno
  • close()
  • read()
  • write()
  • lseek()
  • dprintf()
  • stat()
  • symlink(), link()
  • readlink()
  • unlink()
  • fcntl(), ioctl()
  • Exercises

5. Memory and strings ( et al.)

  • Objectives
  • manipulating memory blocks
  • string manipulation: strchr(), strrchr(), strstr(), strtok()
  • qsort(), bsearch()
  • aligned_alloc(), calloc(), malloc(), and realloc()
  • bcopy()
  • memcpy()
  • memccpy()
  • memmove()
  • bzero()
  • memset()
  • memcmp()
  • Internationalization I18N
    • Unicode, UCS, UTF-8 – how to deal with a multilingual environment?
    • universal character names
    • wide characters supported in different C dialects (, , …)
    • strcoll() and wcscoll()
  • Exercises
  • 6. Processes and threads

  • Objectives
  • definitions, implementations and history
  • thread safety
  • system(), getenv(), setenv()
  • processes – the Unix way:
    • fork()
    • exit()
    • execxx()
    • wait() and waitpid
    • processes – the MS Windows way:
      • CreateProcess()
      • WaitForSingleObject()
    • POSIX threads
    • MS Windows threads
    • C11 threads ()
    • Exercises

    7. Floats and ints once again (, , et al.)

    • Objectives
    • IEEE-754: a different universe
    • NaN, infinity, zero
    • floats and doubles – should we trust them?
    • numerical anomalies vs precision
    • ULP
    • what is a pragma?
    • FENV_ACCESS pragma
    • floating-point exceptions
    • rounding
    • multi-precision libraries (GMP, MPFR, MPIR)
    • Exercises

    8. Network sockets – the absolute basics

  • Objectives
  • what is a socket? what is a network socket?
  • TCP/IP protocol stack, UDP
  • connection and connectionless data transmissions
  • servers and clients
  • big- and little-endians and why you should be aware of them
  • socket addressing: IPv4, IPv6, service numbers
  • getaddrinfo()
  • socket()
  • connect()
  • bind()
  • listen()
  • accept()
  • send() and recv()
  • a simple example of client–server communication
  • a simple example of peer-to-peer communication
  • Exercises
  • 9. Miscellaneous

    • Objectives
    • const variables vs. volatile variables
    • goto – why and why not, advantages, disadvantages and limitations
    • long (non-local) jumps: setjmp() and longjmp()
    • static array indices, designated initializers, compound literals, variable-length arrays, flexible array members, restrict keyword
    • sequence points: why ++/-- may sometimes make you crazy
    • the asm keyword
    • portability issues and undefined behaviors
    • Exercises

    10. Develop a utility - Advanced C Programming

  • Case study explained
  • Course Review

    Exam Preparation (optional)