The C Programming Language in Action

This course will provide you with a complete and practical tour of the C programming language and libraries.
Course info
Rating
(289)
Level
Intermediate
Updated
Mar 10, 2014
Duration
4h 13m
Table of contents
Introduction
Getting Started with Visual C++
Getting Started with GCC
A Tour of the C Programming Language
From Source Files to Programs
Types and Declarations
Structures, Unions, and Enumerations
Statements
Expressions
Pointers and Arrays
Memory Management
Input and Output
Working with Strings
From C to C++
Description
Course info
Rating
(289)
Level
Intermediate
Updated
Mar 10, 2014
Duration
4h 13m
Description

C is a systems programming language and sits at the heart of practically every computing device imaginable. It offers unrivaled performance and supports more devices, processors, and micro-controllers than any other language. This course aims to get you up to speed with the C programming language and libraries. You will learn everything from installing popular compilers, how to compile programs at the command prompt, and how to make sense of the C programming language and libraries.

About the author
About the author

Kenny Kerr is a computer programmer and recognized expert in Windows operating system development and programming languages.

More from the author
Windows Runtime Internals
Advanced
2h 41m
30 Jul 2015
SQLite with Modern C++
Intermediate
2h 33m
18 Feb 2015
The Essentials of the Windows Runtime
Intermediate
2h 48m
2 Sep 2014
More courses by Kenny Kerr
Section Introduction Transcripts
Section Introduction Transcripts

Getting Started with Visual C++
Welcome back to the C Programming Language in Action. In this module, I'm going to show you how to get started with the Microsoft Visual C++ Compiler on Windows. Visual C++ provides both a C and C++ Compiler, and we'll mostly use the C Compiler in this course. It's a great compiler, really the best compiler available on the Windows platform, as it provides first-class support for developing applications for Windows. Most of the other compilers, despite their strengths, are geared towards UNIX operating systems, and thus, are not ideally suited to Windows development. Visual C++ is included with Visual Studio, a suite of development tools for Windows and the web. There are paid versions, which have many benefits, but there are also completely free editions to get you started. These editions are not to time-bombed or restricted in any way. They just don't have some of the most advanced tooling features. In this module, I'll show you how to get your hands on Visual C++ and how to use it to compile C programs, both with the IDE and with the Command Prompt.

Getting Started with GCC
Welcome back to the C Programming Language in Action. In this module, I'm going to show you how to get started with GCC, the GNU Compiler Collection. If you're running on a UNIX operating system, such as the Mac or the Apple OSX operating system or one of the Linux variants, then it's likely that it's either already installed or very easy to get at any rate. On Windows, it's a different story. GCC is not designed to run on Windows and only does so with some help. Fortunately, a developer on the Visual C++ Team at Microsoft has kindly provided a very simple distribution that includes practically everything you need to get started. Let's take a look.

A Tour of the C Programming Language
Welcome back to the C Programming Language in Action. In this module, I'm going to give you a quick tour of C, touching on many language constructs, while not going too deeply on specifics. The idea is to give you a quick introduction so that you're familiar with the language syntax and fundamental structure without necessarily understanding all of its nuances. In subsequent modules, I'll dive into specifics in much more detail, but for now, let's take a nice and gentle tour of the C Programming Language.

From Source Files to Programs
Welcome back to the C Programming Language in Action. We now need to look more closely at the C programming language, what it is, how it works, and, specifically in this module, how source code written in C turns into machine code. C is a compiled language, so we're going to get to grips with what exactly that means and how this all comes together. We're going to look at source and header files, commands, the compiler and linker, object files, and the preprocessor. With these largely mechanical foundations in place, we'll be able to make sense of the rest of this course, when we consider the C programming language in more detail.

Types and Declarations
Welcome back to C Programming Language in action. In this module, we're going to learn about variables. Without variables, no program can do much of anything. Variables let our programs represent, manipulate, and communicate information. This might be information relevant to the users or our programs or just information used internally to hold our programs together and give them life, in programming terms, state. Although we covered variables briefly in the language tour earlier in this course, here we're going to look at them in much closer detail from the point of declaration, how objects come to life, and how long they survive. Let's jump right in.

Structures, Unions, and Enumerations
Welcome back to the C Programming Language in Action. Although this module is mostly about structures, we're also going to look at Unions and Enumerations, which are closely related. Structures are used to build more interesting types, more expressive applications and in particular, more interesting libraries. Unions and enumerations can help to a lesser degree. Let's take a look.

Statements
Welcome back to the C Programming Language in action. In this module, we're going to look at the statements that may be used to execute code in different ways. What is and isn't a statement can get complicated. Declarations are statements, expressions can become statements. Statements generally correspond to code that gets executed, that's why declarations are statements. When declaring a variable inside a function, you may and should include an initializer. That involves code to initialize the value of some variable every time the function is called. But I'm not going to get bogged down with technicalities, that's for the lawyers. What we need to concern ourselves with are the practicalities of how the various statements work to control selection iteration looping and so on. Let's jump right in.

Expressions
Welcome back to the C Programming Language in action. In this module, we're going to explore Expressions specifically. Of course, we've used expressions throughout this course already, but in this module I want to focus specifically on expressions as the focus of our study. Expressions are the most essential building blocks of any program. Expressions produce values from other values, variables, and functions. An expression might be as simple as a value such as 123 or the name of a variable whose name value is then returned and so on. Join me as we explore the power of expressions.

Pointers and Arrays
Welcome back to the C Programming Language in action. In this module, we're going to learn about pointers and arrays. While pointers and arrays also surface as variables, they are unique in some ways, very powerful, and also potentially dangerous. They deserve special attention because they are for better or for worse essential to the construction of any realistic application written in C and even in C++ they are essential in the construction of most libraries if not every C++ application directly. I do love pointers and pointer like abstractions they're one of the things that make C and C++ truly powerful and expressive. Let's explore them together.

Memory Management
Welcome back to the C Programming Language in action. In this module, we're going to learn about Memory Management. Thus far, we've only considered the memory pre-allocated by the Runtime to service the stack. The stack is a functional and required part of any C and C++ program as they are stack based languages. We also briefly looked at statically allocated variables, which receive reserve memory when the program first launches and that memory hangs around until the program comes to an end. While you can define variables on the stack, the stack size tends to be fixed and often quite small depending on the platform you're targeting. If you need more control of your memory allocations, you need to turn to the heap But the heap itself is something that must exist at Runtime, it can be implemented by a library that reserves some static memory. This is very common in embedded systems or it can be implemented entirely by the operating system. That is usually the case with desktop operating systems and certainly the case with Visual C++ on Windows. Let's take a look.

Input and Output
Welcome back to the C Programming Language in action. In this module, we're going to learn all about input and output as provided by the C standard library. We've already been using C's input and output facilities in the form of the printf function, but here in this module, we're going to take a closer look at printf, but also at the other core functions that are used to read and write to the console and read and write to a file and disk. This is sometimes called C's IO stream library, but don't confuse this C++ IO stream library and altogether a different beast whereas the C++ IO stream library is strange and incredibly slow, C's standard input output library, while also offering a stream abstraction, is blazingly fast. It's one of those areas where C completely outshines C++. Let's take a look.

Working with Strings
Welcome back to the C Programming Language in action. In this module, we're going to learn all about working with strings. In most of today's contemporary languages including C++, strings are a object that can be manipulated almost as easily as numbers, but there is a great deal of abstraction that makes that level of convenience possible, usually that's fine, but sometimes the cost is simply too great particularly in embedded system programming. Even for many applications where string searching and sorting is critical, having a good understanding of the fundamental string management functions provided by C can be very beneficial.

From C to C++
Welcome back to the C Programming Language in action. In this module, I want to show you how to move from C to C++, having started with C, C++ is your natural next step as you move up the productivity ladder and consider what C++ has to offer. C++ is a no compromise, next step for the C programmer. It doesn't force you into using any Runtime features or add any overhead that might cause you to turn back to C. It has some optional features that do impose some overhead, but you are free to ignore them especially in the area of embedded systems programming, C can help tremendously in simplifying the complex resource management tasks. Let's take a look at some difference between C and C++ in this module and how you might make use of C++ to simplify your applications.