⚠️ Warning: This is not the current iteration of the course! Look here for the current offering.

C/C++ Language Primers

CS 300 teaches you the fundamentals of computer systems, using the C and C++ programming languages. C and C++ are the two most widely used systems programming languages in industry today; millions of programs including your operating system and the web browser you're using to view this page are written in C and C++.

C and C++ are valuable for every software engineer to know. They are powerful, but also dangerous, tools that give you more control over your computer, and more insight into its magic, than almost any other language.

C

C is an old programming language – it's been around since the 1970s! But despite its simple syntax, it is very powerful and versatile. We will go over the language in lectures, but lectures will move quickly, so additional reference material can be useful.

We recommend these resources:

  • The CS 300 TAs' C Primer is a concise overview of C language syntax and features, as well as helpful debugging tips, and comes in three parts: Part 1, Part 2, and Part 3. Make sure to check this out first, since it's tailored towards the course!
  • C Standard Library Reference from cplusplus.com. Despite the domain name, this site has excellent documentation for the C standard library (other parts of the site are a good C++ reference!).
  • The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie (also known as "K&R"; Prentice Hall PTR, ISBN 0-13-110362-8) is the classic textbook for programming in C.
  • Harvard CS 61's C Patterns explains some handy common tricky that will be useful for your assignments.
  • Linux/OS X/BSD man pages! They're very detailed, but often tell you important details about library functions. Type man 3 <library_function> to open the man page for library_function (e.g., strncpy).

C++

C++ is a popular language for low-level systems coding, and unlike C, its predecessor, it comes with an extensive data structure library and high-level abstraction facilities. Though the course uses C++, it is about systems programming, and we will not use (or teach) the complex object-oriented features in C++ and attempt to avoid its most confusing concepts.

That said, getting familiar with C++'s data structures and libraries will be useful. You can get this information from free resources on the web. Some web resources are almost overwhelmingly detailed, but don't despair! It often works to scroll through reference pages for example code, which can be more concise and clear than the English-language reference material.

We recommend the following resources for C++:


Acknowledgment: We thank Eddie Kohler and Harvard's CS 61 course for some of the above references, which we've reproduced with permission in modified form here.


Creative Commons Licence This work is licensed under a Creative Commons Attribution 4.0 International License.