Start learning with our library of video tutorials taught by experts. Get started

C/C++ Essential Training
Illustration by Richard Downs

C/C++ Essential Training

with Bill Weinman

Video: Welcome

Hi, I am Bill Weinman, and welcome to C and C++ Essential Training. In this course, we'll explore the C and C++ languages along with their standard libraries. I'll start by showing you the basic syntax of C. C syntax is the basis for both C and C++ as well as a number of other derived languages like C#, Java, PHP, and many others. I'll show you how to write classes and templates in C++ so you can access all the power of object-oriented programming. This will enable you to take advantage of modern programming techniques like encapsulation, generalization, and code reuse.
Expand all | Collapse all
  1. 4m 27s
    1. Welcome
      1m 17s
    2. Using the exercise files
      1m 15s
    3. Prerequisites
      1m 55s
  2. 11m 11s
    1. About C
      6m 10s
    2. About C++
      5m 1s
  3. 2h 2m
    1. Using Xcode with the exercise files
      16m 51s
    2. Setting up Eclipse with LLVM and Clang on a Mac
      18m 23s
    3. Setting up Eclipse with GCC on a Mac
      13m 46s
    4. Upgrading GCC on a Mac
      12m 53s
    5. Setting up Eclipse for Windows
      18m 4s
    6. Working with Eclipse on Windows
      2m 56s
    7. Setting up Eclipse in Ubuntu Linux
      18m 36s
    8. Understanding the development cycle with "Hello, World"
      6m 48s
    9. Using stdout and stderr
      7m 3s
    10. Using stdin
      7m 22s
  4. 1h 15m
    1. Exploring the anatomy of a C program
      9m 29s
    2. Writing statements and expressions
      5m 47s
    3. Working with identifiers
      2m 11s
    4. Defining variables
      2m 2s
    5. Understanding identifier scope and using storage classes
      7m 53s
    6. Declaring variables and functions
      5m 59s
    7. Using pointers
      2m 19s
    8. Working with arrays and strings
      5m 9s
    9. Comparing with conditionals
      5m 47s
    10. Using switch statements
      6m 2s
    11. Using while and do loops
      4m 57s
    12. Iterating with the for loop
      6m 10s
    13. Creating functions
      8m 15s
    14. Branching with goto, break, and continue
      3m 30s
  5. 29m 42s
    1. About the C preprocessor
      2m 15s
    2. Defining constants
      4m 55s
    3. Including files
      2m 51s
    4. Exploring conditional compilation
      2m 59s
    5. Defining macros
      3m 47s
    6. Macro caveats
      5m 2s
    7. Working with line continuation using the backslash
      3m 32s
    8. Including files only once
      4m 21s
  6. 1h 1m
    1. About the data types
      3m 21s
    2. Introducing integer types
      4m 11s
    3. Understanding floating-point types
      4m 6s
    4. Working with characters and strings
      2m 25s
    5. Using strings
      5m 0s
    6. Creating character escape sequences
      2m 18s
    7. Working with qualifiers
      5m 0s
    8. Using the C++ reference type
      6m 14s
    9. Working with structured data
      5m 51s
    10. Introducing bit fields
      1m 59s
    11. Working with enumerations
      4m 40s
    12. Using unions
      2m 17s
    13. Defining types with typedef
      2m 9s
    14. Introducing the void type
      5m 35s
    15. Understanding the auto type
      5m 56s
  7. 1h 2m
    1. Exploring the assignment operator
      5m 39s
    2. Using arithmetic operators
      5m 16s
    3. Working with increment and decrement operators
      7m 50s
    4. Using comparison (relational) operators
      2m 49s
    5. Using logical operators
      3m 20s
    6. Exploring bitwise operators
      3m 6s
    7. Working with compound assignment operators
      4m 32s
    8. Using the array subscript operator
      3m 14s
    9. Using pointers, members, and indirection operators
      3m 27s
    10. Exploring the function call operator
      3m 14s
    11. Working with the ternary conditional operator
      1m 57s
    12. Determining the size of a type with sizeof
      2m 55s
    13. Determining the type of an object with typeid
      3m 28s
    14. Using the cast operator
      2m 58s
    15. Working with the new and delete operators
      3m 10s
    16. Understanding operator precedence
      2m 6s
    17. Using operator synonyms
      3m 28s
  8. 35m 51s
    1. Overview of functional programming
      3m 33s
    2. Defining a function
      2m 51s
    3. Passing parameters to a function
      5m 49s
    4. Using automatic and static variables
      1m 39s
    5. Using function pointers
      7m 38s
    6. Overloading function names
      2m 47s
    7. Overloading operators with functions
      3m 24s
    8. Defining a variable number of arguments
      4m 51s
    9. Using recursion
      3m 19s
  9. 1h 18m
    1. Overview of classes and objects
      3m 16s
    2. Exploring namespaces
      5m 2s
    3. Defining a class
      5m 20s
    4. Using data members
      5m 21s
    5. Working with member functions
      8m 47s
    6. Pointing to the current object with the *this pointer
      3m 55s
    7. Using constructors and destructors
      11m 21s
    8. Exploring implicit vs. explicit constructor type conversions
      6m 5s
    9. Overloading operators with member functions
      8m 14s
    10. Overloading operators with non-member functions
      6m 16s
    11. Using conversion operators
      3m 9s
    12. Creating function objects
      1m 54s
    13. Creating and destroying objects with the new and delete operators
      4m 50s
    14. Reporting errors with exceptions
      4m 33s
  10. 24m 41s
    1. Overview of class inheritance
      1m 39s
    2. Exploring simple inheritance
      4m 20s
    3. Reviewing friendship
      4m 34s
    4. Accessing the base class
      2m 11s
    5. Understanding multiple inheritance
      4m 5s
    6. Exploring overloading methods and polymorphism
      7m 52s
  11. 13m 36s
    1. Understanding templates
      2m 24s
    2. Understanding template functions
      5m 48s
    3. Using template classes
      5m 24s
  12. 57m 25s
    1. Overview of the C Standard Library
      2m 45s
    2. Using stdio for file I/O
      12m 52s
    3. Using stdio for file management
      3m 6s
    4. Using stdio for unformatted character I/O
      5m 10s
    5. Using stdio for formatted character I/O
      6m 34s
    6. Using string functions
      6m 56s
    7. Understanding memory allocation
      6m 45s
    8. Handling system errors
      4m 5s
    9. Working with time and date functions
      4m 30s
    10. Getting file information
      4m 42s
  13. 1h 29m
    1. Overview of the STL
      2m 11s
    2. Using vectors
      6m 20s
    3. Working with pairs and tuples
      5m 57s
    4. Writing iterators
      6m 31s
    5. Using lists
      4m 47s
    6. Working with sets
      7m 2s
    7. Creating maps
      7m 38s
    8. Using queues
      4m 53s
    9. Working with stacks
      3m 51s
    10. Introducing the deque container
      3m 18s
    11. Using strings
      3m 37s
    12. Working with algorithms
      16m 10s
    13. Using I/O streams
      9m 23s
    14. Handling exceptions
      7m 58s
  14. 24m 19s
    1. Overview of C++11
      1m 44s
    2. Using the range-based for loop
      5m 1s
    3. Exploring the unambiguous null pointer constant
      3m 34s
    4. Understanding type inference
      8m 4s
    5. Using lambda functions
      5m 56s
  15. 31s
    1. Goodbye
      31s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
C/C++ Essential Training
11h 31m Beginner Jun 28, 2012

Viewers: in countries Watching now:

Widely used for both systems and applications development, the C and C++ programming languages are available for virtually every operating system and are often the best choice for performance-critical applications. In this course, Bill Weinman dissects the anatomy of C and C++, from variables to functions and loops, and explores both the C Standard Library and the C++ Standard Template Library. Features introduced in the C++11 standard (ratified in 2011) are also discussed.

This course serves both as an end-to-end tutorial for those new to the language and a solid reference for experienced C/C++ programmers.

Topics include:
  • Setting up a development environment on Mac, Windows, or Linux
  • Understanding the development cycle
  • Writing statements and expressions
  • Declaring variables and functions
  • Working with arrays and strings
  • Comparing with conditionals
  • Including files and executing macros with the C preprocessor
  • Working with different data types
  • Using operators to perform basic arithmetic and more complicated functions
  • Understanding inheritance
  • C++ template programming
  • Handling system errors and exceptions
  • Using C++ STL containers
  • Using C++11 type inference, Lambda functions, and more
Subjects:
Developer Desktop Apps Programming Languages
Software:
Eclipse C C++
Author:
Bill Weinman

Welcome

Hi, I am Bill Weinman, and welcome to C and C++ Essential Training. In this course, we'll explore the C and C++ languages along with their standard libraries. I'll start by showing you the basic syntax of C. C syntax is the basis for both C and C++ as well as a number of other derived languages like C#, Java, PHP, and many others. I'll show you how to write classes and templates in C++ so you can access all the power of object-oriented programming. This will enable you to take advantage of modern programming techniques like encapsulation, generalization, and code reuse.

I'll show you how to use advanced C++ features like inheritance and templates. I'll show you the standard C library so you can access resources on your system like reading and writing files and allocating memory. We'll cover the C++ standard template library providing powerful data types like vectors, sets, cues, and associative maps. We'll be covering these topics and much more so that you'll have all the resources you need to fully take advantage of this powerful language. C and C++ are among the most powerful and widely used languages today.

Now let's get started with C and C++ Essential Training.

Find answers to the most frequently asked questions about C/C++ Essential Training.


Expand all | Collapse all
please wait ...
Q: On my Mac, after following the instructions in "Upgrading GCC on the Mac," I get an error that says:

    unrecognized command line option "-std=c++11"
A: This means that Eclipse is not invoking the correct version of GCC.

This may be caused by one of two conditions:
1) The hpc-gcc installation is not in the expected location, or
2) The environment variables are incorrect in the Working project settings.

To check the location of the hpc-gcc installation, launch Terminal and type this command:

        ls -l ~/hpc-gcc/

Your result should look something like this:

        $ ls -l ~/hpc-gcc/
        total 0
        drwxr-xr-x  19 billw  staff   646 Jun  7 13:49 bin/
        drwxr-xr-x   7 billw  staff   238 Apr 14 15:15 include/
        drwxr-xr-x  53 billw  staff  1802 Jun  7 13:50 lib/
        drwxr-xr-x   3 billw  staff   102 Mar 17 10:20 libexec/
        drwxr-xr-x   2 billw  staff    68 Jun  7 13:59 share/

If this is not the result you see, follow the instructions again in the first part of the "Upgrading GCC on the Mac" movie to unarchive the compiler and move it into place in your home directory.

 To check that your Working project environment settings are correct follow these steps:

    1. Open Eclipse
    2. In the Project Explorer, select your Working project
    3. Press CMD-I (or Control-click on the Working project) and select "Properties" from the context menu
    4. Expand the C/C++ Build section and select Environment
    5. Check that the Configuration says "Debug [ Active ]"

The Environment variables list should include these entries (they should be highlighted):

        CPATH           ${HOME}/hpc-gcc/include
        LIBRARY_PATH    ${HOME}/hpc-gcc/lib
        PATH            ${HOME}/hpc-gcc/bin:/usr/bin:/bin:/usr/sbin:/sbin

If any of these variables look wrong, you may correct them by selecting an individual variable and pressing the Edit button.

After correcting either of these problems, you should clean the project before trying again. Select Clean from the Project menu, press "Clean all projects," and press the OK button
Q: I am using OS X Snow Leopard (10.6.x) on a Mac. I downloaded the Snow Leopard version of HPC GCC and installed it according to the instructions, but I get this error:

    unrecognized command line option ‘-std=c++11’
A: As of the date of this writing, the Snow Leopard version of hpc-gcc is based on an older version of GCC that does yet support the -std=c++11 switch. Instead, it uses an older version of the -std switch.

In order to use the Snow Leopard version of HPC GCC you will need to change two settings after your installation. Please follow these instructions.

    1. Open Eclipse
    2. In the Project Explorer, select your Working project
    3. Press CMD-I (or Control-click on the Working project) and select "Properties" from the context menu
    4. Expand the C/C++ Build section and select Settings
    5. Under GCC C++ Compiler, select Miscellaneous and change -std=c++11 to -std=c++0x
    5. Under GCC C Compiler, select Miscellaneous and change -std=gnu11 to -std=gnu99

After making these changes, you should be able to follow along with the exercises.
Q: Why is my Working project missing folders for Includes and Debug, and why can't I build my project?
A: This happens if you create a Makefile project instead of a C++ project. You need to delete your Working project and create it again. When you re-create it, be sure to select "C++ Project" from the New Project menu.
Q: Why does Chap07/jump.c use fgets() instead of fgetln()?
A: The fgetln() function is from BSD, so it's not part of the GNU standard library. This means that it works on a Mac but not on Windows or Linux. The fgets() function is the standard way to do this and it works on all modern platforms.
Q:  When setting up the "New CDT Project Wizard" in Eclipse, I don't see a choice for the GCC toolchain (MacOSX GCC on a Mac or MinGW GCC on a Windows PC). What do I need to do?
A:  When setting up the toolchains you need to select "Executable" -> "Empty Project" under "Preferred Toolchains," and when creating a project you need to select "Executable" -> "Empty Project" under "Project type." When the setup movies were recorded, the Executable project type was first in the list. In the latest version of Eclipse it is no longer first in the list, so make sure to select it from the correct spot.

If you select Executable and still don't see the option for your toolchain, or you see it and it's greyed out, you may need to uncheck the box that says "Show project types and toolchains only if they are supported on the platform." This has been know to happen on a Windows PC where MinGW was installed but MS Visual Studio was not installed. If you uncheck this box and are able to select your toolchain, it should still work. This is a bug in Eclipse.
Q: I'm using a Mac running OSX 10.8 or 10.9, what's the best environment for following the exercises?
A: Please use Xcode. Xcode is free and very easy to install. Please follow the instructions in the movie "Using Xcode with the exercise files." There is no need to install GCC or Eclipse for this environment.
 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed C/C++ Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Notes cannot be added for locked videos.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.