C Programming For Beginners
4.2 (3,363 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
22,131 students enrolled

C Programming For Beginners

Learn C in ten easy steps on Windows, Mac OS X or Linux
4.2 (3,363 ratings)
Course Ratings are calculated from individual students’ ratings and a variety of other signals, like age of rating and reliability, to ensure that they reflect course quality fairly and accurately.
22,131 students enrolled
Created by Huw Collingbourne
Last updated 8/2019
English, Indonesian [Auto], 4 more
  • Italian [Auto]
  • Polish [Auto]
  • Romanian [Auto]
  • Thai [Auto]
Current price: $100.99 Original price: $144.99 Discount: 30% off
5 hours left at this price!
30-Day Money-Back Guarantee
This course includes
  • 6 hours on-demand video
  • 2 articles
  • 4 downloadable resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
Training 5 or more people?

Get your team access to 4,000+ top Udemy courses anytime, anywhere.

Try Udemy for Business
What you'll learn
  • Master C programming concepts from the ground up
  • Use the source code examples to learn step-by-step
  • Understand the special features of C: pointers, header files, null-terminated strings, buffers, IO
  • Videos explain everything in minute detail
  • Read the supplied eBook, The Little Book Of C, to explore the topics in even more depth
  • Test your understanding with end-of-section quizzes
Course content
Expand all 76 lectures 08:11:43
+ Getting Ready
15 lectures 50:04

C is an important cross-platform programming language. In this video, I provide a quick introduction to the language and how to learn it using this course.

Preview 04:08

In order to write C programs you will need a suitable editor or IDE (Integrated Development Environment). Here are a few suggestions…

Preview 01:59

This is a PDF document containing answers to a number of common questions that have been asked by students. Please download and read this BEFORE asking any questions in one of the discussion threads. 

Please note that I cannot deal with technical issues relating to CodeLite. You should post question on CodeLite in the CodeLite forum: https://forums.codelite.org/

FAQ - Read This First!
29 pages

In this course I will generally use the free CodeLite C editor which is available for OS X, Windows and Linux. This video shows how to get CodeLite installed on your computer.

Install CodeLite (Windows or Mac)

If you are using a Mac you may need to download some additional tools in order that an editor such as CodeLite is able to find a compiler to build and run your programs.

Install a C compiler on a Mac

Let’s take a quick look at the features of the CodeLite editor – from syntax colouring to keyboard shortcuts. CodeLite makes light work of creating C projects on Windows and OS X.

Introduction to CodeLite

Embarcadero’s C++Builder is a great environment for both C and C++ programming on Windows – and the free edition has everything you need to follow this course.

Using C++Builder

Let’s see how to use C++Builder to create a project from the C code in the source code archive.

Importing C Projects into C++Builder

Maybe you are already use the NetBeans IDE for Java programming. Or maybe you'd just like to use NetBeans as your C environment. Here I explain how to get up and running.

Programming C with NetBeans

There are various ways of importing source code into NetBeans. Here I show a simple way of creating a NetBeans C project using the files from one of my sample projects.

Importing Projects Into NetBeans

You don't need to use an IDE at all. If you are having problems installing an IDE or if you'd prefer to use a simple text editor, you can do so – and compile your programs in a System or Terminal window.

Compiling C programs at the system prompt

If you are a Visual Studio 2019 user, be sure to download and read this document before creating a project.

Visual Studio 2019

If you are using Windows, Microsoft’s Visual Studio (even the free edition) may be used to create C projects. Here I explain how to do that.

Using Visual Studio

The Little Book Of C is the course eBook. There is a chapter for each step of the course. Use the book, the source code and the videos together for a full understanding of the topics discussed.

The Little Book Of C -- (download)
96 pages
C Source Code Archive

Getting ready for C programming

C Basics
3 questions
+ C programming basics
6 lectures 27:05

Here I take a look at a simple program that just displays “Hello world” and discover that even a few lines of C code illustrate a number of important features of the C language.

Preview 06:06

Some “Hello world” programs are more complex than others. Here I look at a program that takes some data as ‘arguments’ and returns a value.

Arguments and return values

Here I explain how to pass arguments from the commandline (or Terminal) to your program.

Passing commandline arguments to your program

If you don’t know how to open a command window on Windows or the Terminal on OS X and use it to run your programs, this lesson explains all.

How to open a command prompt on Windows or OS X

The printf() function lets you display the output from your program. It’s a very useful function but must be used with care – as I explain here.


You can document your code with comments that are ignored by the compiler. Here I explain two types of comment.


Fundamental features of a C program

C Programs
3 questions
+ Variables, constants and types
5 lectures 22:14

Variables are identifiers whose values may vary during the running of your program. This video explains the basics of variables and their types in C.

Variables and types

You may do calculations with both full numbers – integers – and fractional numbers – floating points. But be careful: the end results may not be what you expect!

Integers and floating point numbers

If you want to create identifiers to store values that are not expected to change during the execution of a program, you can #define them.


Identifiers that are created using #define are often used as ‘constants’ – but, in fact, there is an alternative – using the keyword ‘const’. Here I explain the difference.

More about constants

What should you call your variables and constants? Here I consider some of the naming conventions adopted by man C programmers.

Naming conventions

How to declare and use variables and constants

Variables and constants
3 questions
+ Operators, tests and user input
9 lectures 51:16

There are two ‘equals’ operators in C – one uses a single equals sign to assign a value to a variable. Another uses two equals signs to test for equality. Here I explain the difference.

Operators – equality and assignment

You will frequently need to make comparisons between one value and some other value. C has a number of ‘relational operators’ to help you do this.

Operators – tests and comparisons

Some assignment operators in C perform a calculation prior to assigning the result to a variable. These are called ‘compound assignment operators’.

Compound assignment operators

You can use ++ and – to add and subtract 1 from a variable. But be careful – you can put these operators either before or after a variable and the position matters!

Increment and decrement operators

There are times when you need to take different actions according to some test condition. Here I explain how to use if..else tests.

if and else tests

It may seem easy to get input with gets() but this may cause problems. The fgets() function is a safer alternative – but that too may cause its own problems, as I explain here.

Problems with gets() and fgets()

Sometimes you may have more data lurking in the dark corners of your computer’s than you are expecting. Here I explain some of the mysteries of buffers and why they need to be flushed.

Input, buffers and flushing

Here I look at two possible ways of writing a function that safely reads in characters entered at the command prompt and also flushes any unneeded characters from the buffer.

My own line-reading function

If you need to chain together conditions when making tests, you need to use C’s ‘logical operators’.

Logical Operators

Testing and assigning values

Operators and tests
3 questions
+ Functions, arguments and switch
4 lectures 27:56

We’ve used functions from the very start of this course. In this lesson I explain more about what functions are and how they really work.


You can pass data to functions are arguments that are assigned to ‘named parameters’. Here I explain the nitty-gritty details of arguments .


There may be times when you need to take many different possible actions depending on the value of some variable. The switch statement can help out.

Switch statements

In this lesson I look at more examples of switch statements, including some options that are only available with some C compilers.

Switch statements in more detail

Declaring functions and making multi-part tests with switch statements

Functions and switch
3 questions
+ Arrays, loops and break
7 lectures 35:07

Arrays are sequential collections. You can use arrays to store lists of chars, ints and other types of data. Here I explain the fundamentals.


You can add elements to an array at the same time the array is declared. Here I show how to do this and I also explain how the results of calculations may change according to the ‘precedence’ of operators.

Initializing arrays

Sometimes you might want to run some code not for a predetermined number of times but for just as long as some condition remains true. You can use a ‘while’ loop to do this.

‘while’ loops

In some circumstances the code in a ‘while’ may never be run. If you want to ensure that your code is always run at least once, use a ‘do..while’ loop.

‘do..while’ loops

Sometimes it is useful to break out of a loop even if the loop’s test condition is not false. Here I explain how to use break in a ‘while’ or ‘for’ loop.


Sometimes you may want to break from a loop once but then continue running the loop afterwards. Here I explain the difference between ‘break’ and ‘continue’.

break and continue

Arrays can have multiple dimensions to let you star arrays inside arrays. Here I explain how you can think of a two-dimensional array as being a bit like a spreadsheet with intersecting rows and columns.

Multidimensional arrays

Creating and iterating over sequential lists

Arrays and loops
3 questions
+ Strings, chars and pointers
8 lectures 44:19

In order to understand strings in C you need to understand how computer memory can be represented by ‘addresses’ and how pointer variables can refer to those addresses.

Strings, pointers and addresses

Many programming languages have a dedicated string data-type. Here we revise the essential features of C strings and explain the significance of its lack of a string type.

Null-terminated strings

At first sight there may seem to be no difference between an array of chars such as char str[] and a char-pointer such as char *str. In fact the difference is profound and important.

Char arrays and pointers

Here I look at some more examples of using arrays and pointers and consider why you can assign to a pointer variable but not to an array name.

Arrays, pointers and assignment

How do you return strings from functions And we also look at the importance of understanding the ‘stack and ‘heap’ in your computer’s memory.

Strings and functions, stack and heap

C compilers come with ready-to-use string functions. Here I look at some of the traditional functions as well as some more modern alternatives.

String functions

There are also functions that let you analyse individual characters in order to determine to which category each char belongs.

char functions

What is the difference between ‘x’ and “x”? They may look almost identical but, in fact, they are completely different – as this lesson explains.

chars and strings

Strings and memory addresses

Pointers and Strings
3 questions
+ Structs, enums, header files and scope
9 lectures 47:20

Let’s imagine that you want to create a catalogue of your CD collection in which each record contains a name, the artist name, the number of tacks and a user rating. Here I explain how structs can help.


C lets you define your own named types. This makes it possible to create type names for everything from an int to a string to a custom record or struct.

Preview 03:10

Enums let you created groups of named constants that can help to document your code. Here I explain their value – and their limitations.


What is the purpose of the ‘.h’ header files that most C programs include? Here I explain why header files are useful and how they are used during the compilation of your programs.

Header files

Here I look at an example of a header file that provides access to a set of functions and constants that I have written.

A custom header file

‘Scope’ defines the visibility of functions and variables to your code. Here I explain local and global scope and look at the scoping of two variables with the same name.


What is the scope of functions declared in external files – that is, functions that are in different files but the same project?

Scope and external files

Sometimes you may want your functions to be ‘private’ – hidden from code in other files. Here I explain how static functions can do this, and I also explain static variables.

Static functions and variables

To understand better how the compiler and linker work and how the compiler may rely on information from header files, try compiling your projects at the system prompt.

Compiling from the commandline

Delving deeper into C

Structs, enums, headers and scope
3 questions
+ File-handling
5 lectures 19:20

In this step we look at file operations. In this video I explain how to open and close disk files in order to save and load data to and from them.

Opening and closing files

When you open a file you can use a short string to indicate the file ‘mode’. A file mode may make a file available for reading, writing or appending in text or binary format.

File modes

Here I go through the code in a sample project to show how text can be saved to and loaded from a file, how the file contents can be erased and how the file itself can be deleted.

Reading and writing a text file

Once you’ve opened a text file you may want to do something with the text it contains. In this video I show how to count the number of lines in a file.

Counting lines in a text file

Now you know how to read and write text files you can write programs to process the text in a variety of ways – for example, to search for words in a file or encrypt its contents.

Search in a text file

Opening and closing files for reading and writing

3 questions
+ Binary files and memory allocation
8 lectures 42:01

Not all files contain plain text. Some files may contain binary data – for example, if I were to save a CD database to disk, the data stored in each CD struct would have a binary representation. This video explains the basics.

Binary files

Sometimes you need to allocate memory dynamically. But once you’ve finished with that memory you need to free it. This lesson gives an example of code that does this.

Allocating and freeing memory

The C language provides a number of standard data types. Sometimes it is useful to treat one type as another type. In this lesson I explain the hows and whys of ‘type-casting’.

Types and type casts

The final project in this course creates a database of CD structs that are saved in a binary file on disk. This video introduces you to this project.

Creating a CD database

Here I explain how to save a collection of records (structs) into a binary data file and how to calculate the number of records stored before allocating memory when reading them in again.

Saving and loading records in a binary file

Here I explain how to create a new CD struct in memory and then append its data to the end of an existing binary file storing CD records.

Adding records to a binary file

Finally I show an example of how to find a record in a binary file and modify the data it contains. You can use the sample program as a basis for your own data-saving application.

Modifying records in a binary file

More on how C deals with pointers and memory allocation

Memory and pointers
3 questions

We’ve covered a lot of ground in the course on C programming. Now it’s time to move on…

And finally…
  • A C compiler and code editor (both are available free)

The fastest, easiest way to learn to program C on a Mac or Windows. This course will teach you to program the C language from the ground up. You will learn everything from the very fundamentals of programming right through to the complexities of pointers, addresses and File IO. Maybe you've tried to master C before but failed. Or maybe you are new to C or new to programming. If so, this is the course for you!

C is one of the most important of all programming languages. It is used to program desktop applications, compilers, tools and utilities and even hardware devices. The C language is fast and efficient – but it can be hard to learn. Unless you use this course. This course begins with a gentle introduction to C but quickly moves on to explain some of its most confusing features: everything from C's 'scoping' rules to the curious connection between arrays and memory addresses. By the end of the course you will have a deep understanding both of the C language itself and also of the underlying 'architecture' of your computer.

What you will learn:

  • The fundamentals of programming – from the ground up
  • How to program on a Mac or on Windows
  • The nitty-gritty details of the C language
  • Advanced topics such as memory allocation, the stack and heap, and binary file IO

Who should take the course

  • Beginners – if you've never coded before, you can learn C step by step
  • Programmers switching to C from some other language such as Java, Ruby or Python
  • Cross-platform developers – there are C compilers for all major operating systems
  • Anyone who needs to program C++ or Objective-C. The C language is the place to start
Who this course is for:
  • Newcomers to programming
  • Programmers of other languages who want a fast way into C
  • Anyone who needs to master C as a basis for using C++ or Objective-C