Skip to content

Videos

C Programming

Pick a topic to watch.

23 video lessons

2:29 Lesson 1 The C skeleton C works differently from the languages elsewhere on this site, and the difference shapes everything else. You write the source file. Then a compiler reads the… 2:29 Lesson 2 Types and arithmetic In C, every variable has a type, and you say what it is when you make it. An int holds a whole number. A double holds a decimal. A char holds a single… 2:29 Lesson 3 Selection in C C does not have a true-or-false type the way the other languages here do. Instead it has a rule: zero is false, and everything else — one, forty-two, even… 2:10 Lesson 4 Loops in C C gives you two loops, and for counting they do the same job. The while version puts the start, the test and the step in three separate places, and the day you… 2:02 Lesson 5 Functions in C A C function tells you everything about itself in its first line. It starts with the return type — what comes back — and that is required; you cannot leave it… 1:54 Lesson 6 Nested loops A loop inside a loop is not complicated, but the order matters and it is easy to get backwards. The outer counter takes one value. Then the inner loop runs all… 2:31 Lesson 7 Arrays in C An array is several boxes of the same type under one name, sitting side by side in memory. You declare it with a size, and you reach an item with square… 2:34 Lesson 8 Pointers Two lessons ago something odd happened. A function that added one to an int changed nothing outside, because the copy was changed and then thrown away. But a… 2:28 Lesson 9 Strings in C C has no string type at all. What it has is an array of char, and everything about strings in this language follows from that. Write the word hi and you get an… 2:30 Lesson 10 Array algorithms Four jobs come up again and again with arrays, and they look like four different recipes. They are not. Every one of them is the same loop over every item… 2:26 Lesson 11 Two-dimensional arrays A seating plan, a chessboard, a month of temperatures for six cities — these are grids, and one index is not enough for them. So C lets you write two. This… 2:30 Lesson 12 Searching You met this one last lesson. Linear search checks the items one after another, from the front, and returns the index as soon as one matches. If the loop runs… 2:29 Lesson 13 Sorting Every sort in this lesson is built on one small move: exchanging two items. And you cannot do it in two lines, because a box only holds one thing. You have to… 2:29 Lesson 14 Recursion A recursive function is one that calls itself, and every single one has the same two parts. The base case: the smallest version of the problem, which you can… 2:24 Lesson 15 Structs Some values belong together. A point is an x and a y; a rectangle is a width and a height. You can keep them in separate variables, but three points means six… 2:26 Lesson 16 Dynamic memory Every local variable you have written so far lives on the stack. It appears when the function starts and vanishes when it returns, which is usually exactly… 2:21 Lesson 17 Linked lists An array is one solid block. A linked list is the opposite: small structs called nodes, scattered anywhere in the heap, each one holding a value and a pointer… 2:21 Lesson 18 Stacks and queues A stack and a queue both hold a line of items. They differ in one thing only: which item comes out next. Put one, two and three into a stack and it behaves… 2:30 Lesson 19 Text files Everything you have written so far lives entirely in memory, so when the program ends, all of it disappears with it. A file is different. It sits on disk, and… 2:19 Lesson 20 Error handling In many languages, a function that cannot do its job will throw an exception, and somewhere up the call chain someone catches it. C has nothing of the kind. A… 2:30 Lesson 21 Bits and binary Inside the machine an int is not a decimal number; it is a row of bits, each one a nought or a one. Reading it works exactly like ordinary place value, except… 2:19 Lesson 22 Run-length encoding Compression makes data smaller, and run-length encoding is the simplest method there is. It looks for runs — stretches where the same character repeats. Take… 2:31 Lesson 23 Before the compiler Something runs before the compiler ever sees your file. It is called the preprocessor, and it handles every line beginning with a hash. You have used it since…

Log in or create account

IGCSE, A-Level & AP