Skip to content

Hosein-Rahnama/the-c-programming-language

Repository files navigation

The C Programming Language

This is a repository for codes from the text of the following book, known as K&R. I would like to add solutions to the exercises whenever time permits.

  • B. W. Kernighan, and D. M. Ritchie, The C Programming Language, 2nd Edition, Prentice Hall, 1988.

Table of Contents

Here is a short version of the table of contents, containing the title of the chapters.

  • Chpater 1. A Tutorial Introduction
  • Chapter 2. Types, Operators, and Expressions
  • Chapter 3. Control Flow
  • Chapter 4. Functions and Program Structure
  • Chapter 5. Pointers and Arrays
  • Chapter 6. Structures
  • Chapter 7. Input and Output
  • Chapter 8. The UNIX System Interface
  • Appendix A. Reference Manual
  • Appendix B. Standard Library
  • Appendix C. Summary of Changes

Compiler

As the publishing year of the book suggests, it follows the C89 standards. However, we may use some new features of the C99 or C11 within the codes, which are supported by all modern compilers. You can take a look at this wikipedia page for a brief history of the C standards. All of the codes were tested with the gcc and clang compilers.

Scripts

There is a small ./do script, which handles running, cleaning and formatting of source codes. You can use it as shown below.

./do <command> <program> <version>

The <command> argument can be run, clean, or format. For exmaple, you can run a program like

./do run digits-counting ver-1

If some program does not have any specific version, then just use its name. Also, if you would like to remove all executables, you may run

./do clean --all

The formatting is done via clang's formatter and its setting is included in the .clang-format file. You can format source files of a program seperately as above or format all the source files with

./do format --all

About

This repository contains code from Kernighan and Ritchie's classic book, The C Programming Language.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors