Programming Open textbook
C programming basics: where C came from, how a program is built, printf and variables
Built automatically from the first chapters of the open textbook "C programming" on Wikibooks: why C, its history, the first program and how it is built, printf, variables and scanf. Not reviewed by a person.
3 lessons, 21 steps
A first look at C, one question at a time
This course is a first look at C for people who have not written it before. It follows the opening chapters of the open textbook "C programming" on Wikibooks, from why C is worth learning to reading what the user types. Most steps ask what the book says or what a short snippet does; no step asks you to write a program.
Lesson 1 has no code. It covers why the book prefers C to assembly, including portability, the line of languages from Fortran to B that led to C, how versions of the C standard are named, and what a beginner needs to start: a text editor, a compiler and the command line. Lesson 2 goes through the book's hello program and the stages that build it: the preprocessor, the syntax check, the object file and linking. You meet header files such as stdio.h, the exit status that main returns, the two forms of comments and how many values an 8-bit char can hold. Lesson 3 covers printf with a field width, variable names, block scope, static and const variables, and why scanf needs &a rather than a.
Each lesson has a one-minute introduction and seven steps. You pick an option, put items in order, or type a word or a number. When your answer is wrong, the AI tutor asks a question about it, then gives a hint, then a partial step, and Show solution is always there. A four-question quiz before and after each lesson shows what changed.
Know where the material comes from. The course was built automatically from the open textbook "C programming" on Wikibooks, and no person has reviewed it. The book is written by volunteers and may contain errors, and the three lessons cover only its first chapters.
What the lessons cover
- Explain why the book prefers C to assembly and put the languages that led to C in order
- Order the stages that build a C program, from the preprocessor to linking
- Predict what printf prints with a field width and which variable a name refers to after a block
- Say what static and const do to a variable and why scanf needs the address of a variable
Lessons
Why C, and Where It Came From
Your First C Program and How It Is Built
Output, Variables and Input
Reading a printf field width

Tutor: The width in a format specifier is the minimum number of characters a value takes up. The call printf("[%6d]", 42); prints 42 between square brackets. How many spaces come between [ and 42?
You: 6

Tutor: Does the width count the digits of the number as well?
You: Yes. 42 takes 2 of the 6 characters, so there are 4 spaces.

Tutor: Right, 4. The number is right-aligned and the spaces fill the rest of the width.
Who this C warm-up fits
- You want a first taste of C before a programming class or a course that uses it.
- You know a little Python or JavaScript and want to see how a C program is compiled and linked.
- You want to know why C is worth learning and where it came from.
- You are fine with a short, automatically built practice set instead of a full C course.
About this C programming course
Do I write and compile C code in the app?
No. You read short snippets and answer questions about them: pick an option, type a word such as variadic, or enter the number a line of code prints. If you want to compile the snippets yourself, lesson 1 covers what the book says you need: a text editor and a compiler.
Does the course cover pointers, arrays or loops?
No. The three lessons stop at printf, variables and scanf. Lesson 3 explains that & gives scanf the address of a variable, but pointers, arrays and loops are not covered.
Who checked the questions?
Nobody. The lessons were generated automatically from the open textbook and were not reviewed by a person. The sources and their CC BY-SA 4.0 license are listed below, so you can compare any step with the original chapter.
Is the course free?
One lesson in Ai Teacher is free. After that, a subscription opens all lessons. You can pay monthly or yearly in Google Play, and usage limits apply.
Source and license
This course is adapted from C programming, an open textbook on Wikibooks written by Wikibooks contributors (see the page history of each chapter below). The textbook is licensed under CC BY-SA 4.0.
This course was built automatically from the open textbook "C programming" on Wikibooks. No person has reviewed it. Changes: Adapted by AI into lessons and questions; shortened. Written by volunteers; it may contain errors.
Chapters used
Related courses
- Programming
Python from Zero
For adults who have never programmed: read short Python programs, work out what they print and choose fixes for common mistakes with variables, if / elif / else and loops. You type or pick each answer; the app does not run code.
3 lessons, 18 steps - Programming Open textbook
JavaScript
Built automatically from early chapters of the open textbook "JavaScript" on Wikibooks: JavaScript in HTML, syntax, lexical structure, dates and arrays. Not reviewed by a person.
From Wikibooks, 3 lessons - Computers Open textbook
Introduction to Computers
Built automatically from early chapters of the open textbook "Introduction to Computers" on Wikiversity: computer types, hardware and software, the processor and future peripherals. Not reviewed by a person.
From Wikiversity, 3 lessons