C Programming for Python Programmers
Duration
3 days
Overview
The C Programming for Python Developers course is for students who desire to learn the C programming language and incorporate custom C libraries into their Python programs. The course teaches students the essentials of C programming to write programs and code libraries. Knowledge of Python is optional, but references to Python will be made towards the end of the class.
Objectives
- Learn how to set up a C programming environment.
- Explore how to program and run C programs.
- Learn code organization through functions and include files.
- Understand static typing and dynamic memory allocation.
- Practice writing C code called from Python.
Prerequisites
All students must be software developers with a strong understanding of software development and other programming languages. Ideally, students should be able to write simple Python scripts using basic data types, program structures, and the standard Python library.
Training Materials
All students receive comprehensive courseware covering all topics in the course. Courseware is distributed via GitHub in the form of documentation and extensive code samples. Students practice the topics covered through challenging hands-on lab exercises.
Software Requirements
Students will need a free, personal GitHub account to access the courseware. Students will need permission to install Python, C Compiler, and Visual Studio Code on their computers. Also, students will need permission to install Python Packages and Visual Studio Extensions. If students are unable to configure a local environment, a cloud-based environment can be provided.
Outline
- Development Environment
- Overview of Virtual Machine for Class
- Visual Studio Code Extensions for C
- Debugging C with VS Code
- C Programming Language
- Development Tools
- Makefile
- CMake
- CPP Check
- Program Structure
- Main Function
- Include Files
- Header Files
- Compile to Executable
- Compile to Shared Library
- Using Libraries
- Common Compile Options
- Data Types
- Numbers
- Strings (Arrays of Characters)
- Arrays
- Structs
- Type Defs
- Type Casting
- Static Typing vs. Dynamic Typing
- Loose Typing vs. Strong Typing
- Static Types
- Control Flow
- If
- Switch
- While
- Do-While
- For
- Goto
- Functions
- Define a Function
- Call a Function
- Passing Arguments/Parameters
- Return Values
- Function References
- Pointers
- Pass By Value vs. Pass By Reference
- Dynamically Allocating Memory on the Heap
- Principles and Practices of Dynamic Memory Allocation
- Linked Lists
- Untyped Pointers
- Python and C Integration
- Numpy Arrays
- Ctypes FFI
- Python Struct and Structure
- Create a Simple C-Extension for Python
- Debug a C-Extension for Python
- Review C Code generated by Cython
- Basic Profiling of C functions
- Development Tools