Introduction to programming in C – Saturday 16 July

This course is fully booked – thank you for your support!
C-programming

Mario de Sousa, a professional C programmer with 15+ years experience and long time House4Hack member, are presenting an introduction to programming in C course on Saturday 16 July at House4Hack.

Why learn C?

Since its development in the early 1970’s for the Unix operating system, it has since become one of the most widely used programming languages of all time, with C compilers from various vendors available for the majority of existing computer architectures and operating systems. It provides low-level access to memory and maps efficiently to machine instructions – which means that if you understand C, you will have a much better understanding of how computers (and embedded devices) works!

Who is this course for?

This course is for anyone who has some basic experience in programming, e.g. scripting languages like Python or high level embedded programming like Arduino and are curious to really see under the hood, to understand how computers really work and gain a very power tool for their programming toolbox.  You will also appreciate the advantage of scripting languages and the cost associated with using them.

When: Saturday 16 July
Time: 9.00 – 15.00
Where: House4Hack in Centurion – 4 Burger ave, Lyttleton Manor
Cost: R550 per person
Prerequisites: Laptop with either Windows with Visual Studio or Linux with gcc build essentials installed. The attendees are expected to have basic programming knowledge and have coded in a scripting or other high level language.

Course outline:

 

00 – Brief overview of C

  • Developed by Dennis Ritchie in the early 70’s at AT&T’s Bell Labs
  • Used to re-implement Unix (originally developed in ASM)
  • Imperative/procedural language
  • Designed for low-level hardware access
  • A compiler is available for almost every platform
  • A relatively “small” language
  • Latest standard is C11 (December 2011)

01 – Hello

  • Program structure
  • #include pre-processor directive
  • Comments
  • main() function definition (return type, args)
  • Return value to OS
  • puts() function call
  • Man-page for puts()
  • White-space
  • Compilation
  • Warning on omitted #include
  • Simple Makefile

02 – Basic data-types

  • Integral types (char, int)
  • Floating-point types (float, double)
  • Literals and variables
  • Type modifiers (signed, unsigned, short, long)
  • Type qualifiers (const, volatile, register, restrict)
  • printf() formatting
  • Implementation-dependent sizes
  • Fixed-size integral types
  • sizeof operator and size_t type
  • Void type
  • Int as boolean and C11 bool type

03 – Basic data-types (continued)

  • Signed vs. unsigned
  • Implicit type conversion
  • Explicit type conversion (casting)
  • Integer promotion

04 – Operators

  • Arithmetic operators
  • Type conversion in arithmetic expressions
  • Relational operators
  • Logical operators
  • Bit-wise operators
  • Parentheses, BODMAS and NAO
  • Compound assignment operators
  • Ternary conditional operator
  • Member and pointer operators (explained as encountered)

05 – Arrays

  • #define pre-processor macro (non-parameterised)
  • #define vs static const (quick explanation)
  • Arrays and array index operator
  • Strings (char arrays)
  • Valgrind memcheck

06 – Control-flow statements

  • Block/lexical scope
  • if/if-else statement
  • nested if/if-else statements
  • while-loop statement
  • do-while-loop statement
  • for-loop statement
  • continue and break statements
  • switch statement

07 – Functions

  • Declaration and definition
  • Local variables
  • Scope revisited
  • Function call
  • Function “overloading” via type-generic expressions (optional)

08 – Enums & Structs

  • Enum definition
  • Enum variables
  • Struct definition
  • Struct variables
  • typedef aliasing

09 – Pointers

  • Declaration
  • Address-of and dereference operators
  • Top-level and low-level const with pointers
  • Arrays decaying to pointers
  • Pointer arithmetic
  • Index operator with pointers
  • Pointers as function arguments
  • Strings as char *

10 – Dynamic memory allocation

  • Stack vs. heap memory
  • malloc() and free()
  • Memory leaks
  • Valgrind memcheck revisited

11 – Function pointers

  • Function pointer variables
  • typedef alias for function pointer type
  • Calling function pointers

12 – File I/O

  • Reading/writing to file
  • stdin/stdout as files

13 – Your own string library

  • C header files
  • Header file inclusion guard
  • String length
  • String concatenation
  • String reverse
  • Building a static library
  • Linking static library

14 – Simple command-line word-counter (subject to time)

  • Reading text from Unix pipe
  • Counting number of words
  • Writing result to Unix pipe

15 – Linked-lists, queues and stacks (subject to time)

  • Linked-list data-structure explained
  • Implementing linked-list node struct
  • Implementing linked-list insert/delete/contains/element-at algorithms
  • Advantages/disadvantages of linked-lists vs. arrays
  • Creating a queue data-structure from a linked-list
  • Creating a stack data-structure from a linked list

 

About the presenter:
photoMario de Sousa will be presenting this course, he is a long time House4Hack member and has been a professional software engineer since 2001.  He is currently the chief software engineer at QuickTrav.  He completed a BSc in Computer Science and Information systems and has experience in enterprise retail, finance, payment processing, merchandising, and accounting software systems.  During his career he has developed and maintained software written in  C, C++, Java, Python, COBOL, Clipper/Harbour, and JavaScript

 

 

 

This course is fully booked – thank you for your support

This course is fully booked – thank you for your support! Mario de Sousa, a professional C programmer with 15+ years experience and long time House4Hack member, are presenting an introduction to programming in C course on Saturday 16 July at House4Hack. Why learn C? Since its development in the early 1970’s for the Unix…

Comments

Leave a Reply