We may earn an affiliate commission when you visit our partners.
Course image
Huw Collingbourne

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.

Read more

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.

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
Enroll now

Here's a deal for you

We found an offer that may be relevant to this course.
Save money when you learn. All coupon codes, vouchers, and discounts are applied automatically unless otherwise noted.

What's inside

Learning objectives

  • 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

Syllabus

Getting Ready

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.

Read more

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

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/

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.

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.

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.

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.

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

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.

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.

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.

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

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.

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.

C Source Code Archive

Getting ready for C programming

C programming basics

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.

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.

Here I explain how to pass arguments from the commandline (or Terminal) 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.

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

Variables, constants and types

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.

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!

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.

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

How to declare and use variables and constants

Operators, tests and user input

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.

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.

Some assignment operators in C perform a calculation prior to assigning the result to a variable. These are called ‘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!

There are times when you need to take different actions according to some test condition. Here I explain how to use if..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.

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.

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.

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

Testing and assigning values

Functions, arguments and switch

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.

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

Declaring functions and making multi-part tests with switch statements

Arrays, loops and break

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.

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.

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.

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’.

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.

Creating and iterating over sequential lists

Strings, chars and pointers

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.

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.

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.

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.

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.

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.

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

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

Strings and memory addresses

Structs, enums, header files and scope

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.

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.

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

‘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?

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.

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.

Delving deeper into C

File-handling

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.

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.

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.

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.

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.

Opening and closing files for reading and writing

Binary files and memory allocation

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.

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.

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’.

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.

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.

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.

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.

More on how C deals with pointers and memory allocation

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

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Teaches C programming from the ground up, which is useful knowledge for programmers new to C
Develops an understanding of the underlying architecture of your computer
Suitable for beginners, programmers switching to C from other languages, cross-platform developers, and those who need to know C++ or Objective-C
Prepares learners for C++ or Objective-C programming
This course is taught by Huw Collingbourne, an experienced programmer and instructor

Save this course

Save C Programming For Beginners to your list so you can find it easily later:
Save

Reviews summary

Strong foundations in c programming

According to students, this course provides a solid foundation in C programming. While learners say that the course covers the basics well, they also note that some topics, such as file handling functions, could be explained in more detail.
Course covers C programming basics well.
File handling functions could be explained in more detail.
"topics on file handling functions could have been explained in more detail like what happens to the pointer what is returned etc."

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in C Programming For Beginners with these activities:
Review the concepts of file I/O
Refreshes your understanding of files and how to interact with them.
Browse courses on File Input and Output
Show steps
  • Read up on file handling concepts in C
  • Review the syntax and usage of common file I/O functions like 'fopen', 'fread', and 'fwrite'
  • Practice opening, reading and writing to files
Solve coding problems and challenges on platforms like LeetCode or HackerRank
Sharpens your problem-solving skills, improves your efficiency, and tests your understanding of algorithms and data structures.
Show steps
  • Sign up on platforms like LeetCode or HackerRank
  • Select coding problems that align with the concepts covered in the course
  • Solve the problems and learn from your mistakes
  • Discuss your solutions with others and explore alternative approaches
Participate in online coding challenges or competitions
Encourages you to test your skills, learn from others, and stay updated with industry trends.
Browse courses on Coding Challenges
Show steps
  • Find reputable online coding platforms that host challenges or competitions
  • Regularly participate in coding challenges to improve your problem-solving abilities
  • Study the solutions and approaches of other participants
One other activity
Expand to see all activities and additional details
Show all four activities
Write blog posts or articles on C programming concepts
Allows you to reinforce your understanding, share your knowledge, and potentially reach a wider audience.
Browse courses on Technical Writing
Show steps
  • Identify topics that you have a strong grasp of and that are relevant to the course
  • Research additional information and organize your thoughts
  • Write clear and concise blog posts or articles explaining the concepts
  • Publish your articles on platforms like Medium or your own blog

Career center

Learners who complete C Programming For Beginners will develop knowledge and skills that may be useful to these careers:
Computer Programmer
A Computer Programmer writes, tests, and maintains computer programs. They work with a variety of programming languages and tools to develop software applications. This course can help you gain the skills necessary to write, test, and maintain computer programs. You will learn about the basics of programming, including data types, variables, operators, and control structures. You will also learn about the different types of programming languages and how to use them to develop software applications. This knowledge will be essential for a career as a Computer Programmer.
Software Engineer
A Software Engineer designs, develops, and maintains software systems. They work with a variety of software technologies and tools to develop software applications. This course can help you gain the skills necessary to design, develop, and maintain software systems. You will learn about the different types of software systems, how they work, and how to design and develop them. You will also learn about the different types of software technologies and tools and how to use them to develop software systems. This knowledge will be essential for a career as a Software Engineer.
Computer and Information Research Scientist
A Computer and Information Research Scientist conducts research in the field of computer science. They work on a variety of topics, including artificial intelligence, machine learning, and computer architecture. This course can help you gain the skills necessary to conduct research in the field of computer science. You will learn about the different types of research methods and how to use them to conduct research. You will also learn about the different areas of computer science and how to conduct research in those areas. This knowledge will be essential for a career as a Computer and Information Research Scientist.
Computer Hardware Engineer
A Computer Hardware Engineer designs, develops, and tests computer systems and components. They work with a variety of hardware components, including processors, memory, storage devices, and input/output devices. They also develop software to control and operate hardware devices. This course can help you gain the skills necessary to design, develop, and test computer hardware systems. You will learn about the basics of computer architecture, computer organization, and operating systems. You will also learn about the different types of hardware components and how they interact with each other. This knowledge will be essential for a career as a Computer Hardware Engineer.
Computer Science Teacher
A Computer Science Teacher teaches computer science to students at a variety of levels. They work with students to help them learn about the different areas of computer science, including programming, computer architecture, and operating systems. This course can help you gain the skills necessary to teach computer science to students at a variety of levels. You will learn about the different areas of computer science and how to teach them to students. You will also learn about the different types of teaching methods and how to use them to teach computer science. This knowledge will be essential for a career as a Computer Science Teacher.
Web Developer
A Web Developer designs, develops, and maintains websites. They work with a variety of web technologies and tools to develop websites. This course can help you gain the skills necessary to design, develop, and maintain websites. You will learn about the different types of web technologies and tools and how to use them to develop websites. You will also learn about the different types of websites and how to design and develop them. This knowledge will be essential for a career as a Web Developer.
Computer Systems Analyst
A Computer Systems Analyst designs, develops, and implements computer systems. They work with users to determine their needs and then design and develop systems to meet those needs. They also implement and maintain these systems. This course can help you gain the skills necessary to design, develop, and implement computer systems. You will learn about the different types of computer systems, how they work, and how to design and develop them. You will also learn about the different types of software and how to use them to develop systems. This knowledge will be essential for a career as a Computer Systems Analyst.
Database Administrator
A Database Administrator designs, implements, and maintains databases. They work with a variety of database technologies and tools to develop and maintain databases. This course can help you gain the skills necessary to design, implement, and maintain databases. You will learn about the different types of database technologies and tools and how to use them to develop and maintain databases. You will also learn about the different types of databases and how to design and implement them. This knowledge will be essential for a career as a Database Administrator.
Software Tester
A Software Tester tests software to find bugs and errors. They work with a variety of software applications and tools to test software. This course can help you gain the skills necessary to test software. You will learn about the different types of software testing and how to perform them. You will also learn about the different software testing tools and how to use them. This knowledge will be essential for a career as a Software Tester.
Network Administrator
A Network Administrator designs, implements, and maintains computer networks. They work with a variety of network technologies and tools to develop and maintain networks. This course can help you gain the skills necessary to design, implement, and maintain computer networks. You will learn about the different types of network technologies and tools and how to use them to develop and maintain networks. You will also learn about the different types of networks and how to design and implement them. This knowledge will be essential for a career as a Network Administrator.
Data Analyst
A Data Analyst analyzes data to find trends and patterns. They work with a variety of data analysis tools and techniques to analyze data. This course can help you gain the skills necessary to analyze data to find trends and patterns. You will learn about the different data analysis tools and techniques and how to use them to analyze data. You will also learn about the different types of data and how to analyze them. This knowledge will be essential for a career as a Data Analyst.
Information Security Analyst
An Information Security Analyst designs, implements, and maintains information security systems. They work with a variety of information security technologies and tools to develop and maintain these systems. This course can help you gain the skills necessary to design, implement, and maintain information security systems. You will learn about the different types of information security technologies and tools and how to use them to develop and maintain these systems. You will also learn about the different types of information security threats and how to protect against them.
IT Consultant
An IT Consultant provides consulting services to organizations on a variety of IT topics. They work with a variety of IT technologies and tools to provide consulting services. This course can help you gain the skills necessary to provide consulting services on a variety of IT topics. You will learn about the different IT technologies and tools and how to use them to provide consulting services. You will also learn about the different types of IT consulting services and how to provide them. This knowledge will be essential for a career as an IT Consultant.
IT Manager
An IT Manager oversees the IT department of an organization. They work with a variety of IT technologies and tools to manage the IT department. This course can help you gain the skills necessary to manage an IT department. You will learn about the different IT technologies and tools and how to use them to manage an IT department. You will also learn about the different types of IT management tasks and how to perform them. This knowledge will be essential for a career as an IT Manager.
Technical Writer
A Technical Writer writes technical documentation, such as user manuals, technical reports, and white papers. They work with a variety of technical topics, including software, hardware, and engineering. This course can help you gain the skills necessary to write technical documentation. You will learn about the different types of technical documentation and how to write them. You will also learn about the different technical topics and how to write about them. This knowledge will be essential for a career as a Technical Writer.

Reading list

We've selected ten books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in C Programming For Beginners.
Is considered the 'bible' of C programming and must-read for anyone who wants to learn the language in-depth. It covers all the core concepts of C, from basic syntax to advanced topics like memory management.
Classic work on C programming that covers a wide range of topics, from the history of the language to advanced programming techniques. It great resource for anyone who wants to learn more about the C programming language.
Provides a comprehensive guide to C++ templates. It great resource for anyone who wants to learn more about how to use templates to write effective and efficient C++ code.
Provides a comprehensive overview of C++ concurrency. It covers a wide range of topics, from basic threading to advanced synchronization techniques.
Collection of common traps and pitfalls that C programmers often encounter. It great resource for anyone who wants to improve their C programming skills and avoid common mistakes.
Great choice for absolute beginners who want to learn C programming from the ground up. It covers all the basics of the language in a clear and concise way.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to C Programming For Beginners.
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser