An introduction to programming in C
Course description
Rough notes:
The aim of this course is to give you a strong foundation in programming using the C language. It will focus on practical programming skills and problem solving, and will run for several weeks in the evenings and/or on weekends. In the first session you will create a basic C program. and you will learn to develop and test more sophisticated programs in each session of the course. After introducing the basics, we'll help you find a programming project that interests you, and we will give you the support to get it off the ground. By completing this course you will reach a similar level to people completing a good undergraduate degree module in C programming.
The course will start with computer programming, so we can focus on the software instead of the electronics, but the same skills can be used in microcontroller programming. You will learn about the main components of a personal computer, how the computer hardware interprets different types of data, and you will understand distinctions between: hardware, software, and operating system.
You will learn how to design a sequence of actions to accomplish a task (algorithms) and you'll learn some ways to represent complex data in the computer's memory (data structures). You'll also learn how to find and correct mistakes in your program description (debugging).
More than a university course can offer
This course is designed for a hackspace, so it's different from a university course. We have gathered these course materials and exercises so we can teach each other in a structured way. The course tutors will be experienced programmers and we will invite local developers to come and give brief talks, but the focus will be on practical exercises and skills you can use to make awesome things.
Equipment you’ll need
You'll need to bring a computer.
Todo:
- Clarify minimum specs (especially: operating system versions, and whether CD drives/USB ports will be needed to install the software).
What you need to be familiar with
If you need any help to prepare for the course, you are welcome to approach us on an open hack night or ask on our mailing list. You will need basic proficiency in typing and will need to know how to use your computer, including how to: install and run software, edit and save text files, and manage files and directories. No previous programming experience will be needed though.
Suggested preparatory work
- Familiarise yourself with file management on your computer. It's important to know about files, directories, and file extensions.
- If you use GNU/Linux or OSX, then familiarise yourself with your program of choice: Nautilus, Thunar, Finder or the command shell.
- If you have to use Microsoft Windows, make sure you are able to use Windows Explorer (and see [1]).
- Make sure your computer is working reliably and that you have any passwords needed to install programs on the computer.
What we won’t cover
Physical computing and electronics will not be covered by this course, and language theory will not be covered in any depth. The C++ programming language will not be covered.
Software and costs
All of the software used in this course is GPL software that is freely available.
Course syllabus
The following list gives an overview of the course content in technical terms. The indentation of the list gives an impression of how the topics will be approached. Do not worry if the terminology below makes little sense to you now, because the course will teach you this jargon.
- Brief overview of computer systems:
- Hardware, firmware and software
- Operating systems
- Components of modern PCs
- Fundamental computer architecture
- Programming concepts and tools:
- Elements of programming languages (syntax, semantics, libraries)
- Choosing an appropriate language for an application
- The pros and cons of the C language
- toolchains and IDEs
- Bugs and debugging
- Data arrays and named locations – This can be illustrated with a spreadsheet program
- The C language
- Data types
- Basic types, e.g. char, int, long, float, double
- The meaning of void
- Variables
- Storage class specifiers: auto, static & external
- Scope and lifetime of variables
- Arrays
- Pointers
- Operators
- Arithmetic: add, subtract, multiply …
- Logical & Boolean: AND, OR, NOT
- Comparison: equal, greater-than, less-than …
- Cast
- The pre-processor
- Symbolic constants
- Macros
- An introduction to ANSI standard functions
- Input and output of data: printf, scanf, putchar & getchar
- File access
- Control structures
- Conditional expressions: if, if…else, if…else if
- Loops: for, while, do-while
- The switch and break statements
- Nesting
- Functions (Subroutines)
- Return values
- Formal and actual arguments
- Pass by value
- Pass by reference
- Prototyping
- ASCII strings
- ASCII character codes
- Null terminators
- Processing arrays
- Passing arrays to functions
- Data types
- Advanced concepts:
- Dynamic data structures: the linked list
- Defensive programming
- Abstract data types in C
Course materials
- Information for tutors
- An introductory weekend event could offer some initial taster sessions:
- Additional sessions could be run in the evenings for 8-10 weeks:
Course delivery
Todo:
- Dates & times
- Number of places
- Things to take away: bundle of software, teaching materials, etc.
- Bios of tutors
- Prices and payment options
- Coursework
- Assessment? (probably not)