Modern C
Jens Gustedt
  • November 2019
  • ISBN 9781617295812
  • 408 pages
  • printed in black & white

Great introductory material to the ‘new’ C. This isn’t your grandfather’s C anymore!

Hugo Durana, Microsoft
Modern C focuses on the new and unique features of modern C programming. The book is based on the latest C standards and offers an up-to-date perspective on this tried-and-true language.

About the Technology

C is extraordinarily modern for a 50-year-old programming language. Whether you’re writing embedded code, low-level system routines, or high-performance applications, C is up to the challenge. This unique book, based on the latest C standards, exposes a modern perspective of this tried-and-true language.

About the book

Modern C introduces you to modern day C programming, emphasizing the unique and new features of this powerful language. For new C coders, it starts with fundamentals like structure, grammar, compilation, and execution. From there, you’ll advance to control structures, data types, operators, and functions, as you gain a deeper understanding of what’s happening under the hood. In the final chapters, you’ll explore performance considerations, reentrancy, atomicity, threads, and type-generic programming. You’ll code as you go with concept-reinforcing exercises and skill-honing challenges along the way.
Table of Contents detailed table of contents

LEVEL 0 Encounter

1 Getting started

1.1 Imperative programming

1.2 Compiling and running


2 The principal structure of a program

2.1 Grammar

2.2 Declarations

2.3 Definitions

2.4 Statements

2.4.1 Iteration

2.4.2 Function calls

2.4.3 Function return


LEVEL 1 Acquaintance

3 Everything is about control

3.1 Conditional execution

3.2 Iterations

3.3 Multiple selection


4 Expressing computations

4.1 Arithmetic

4.1.1 +, -, and *

4.1.2 Division and remainder

4.2 Operators that modify objects

4.3 Boolean context

4.3.1 Comparison

4.3.2 Logic

4.4 The ternary or conditional operator

4.5 Evaluation order


5 Basic values and data

5.1 The abstract state machine

5.1.1 Values

5.1.2 Types

5.1.3 Binary representation and the abstract state machine

5.1.4 Optimization

5.2 Basic types

5.3 Specifying values

5.3.1 Complex constants

5.4 Implicit conversions

5.5 Initializers

5.6 Named constants

5.6.1 Read-only objects

5.6.2 Enumerations

5.6.3 Macros

5.6.4 Compound literals

5.7 Binary representions

5.7.1 Unsigned integers

5.7.2 Bit sets and bitwise operators

5.7.3 Shift operators

5.7.4 Boolean values

5.7.5 Signed integers

5.7.6 Fixed-width integer types

5.7.7 Floating-point data


6 Derived data types

6.1 Arrays

6.1.1 Array declaration

6.1.2 Array operations

6.1.3 Array length

6.1.4 Arrays as parameters

6.1.5 Strings are special

6.2 Pointers as opaque types

6.3 Structures

6.4 New names for types: type aliases


7 Functions

7.1 Simple functions

7.2 main is special

7.3 Recursion


8 C library functions

8.1 General properties of the C library and its functions

8.1.1 Headers

8.1.2 Interfaces

8.1.3 Error checking

8.1.4 Bounds-checking interfaces

8.1.5 Platform preconditions

8.2 Mathematics

8.3 Input, output, and file manipulation

8.3.1 Unformatted text output

8.3.2 Files and streams

8.3.3 Text IO

8.3.4 Formatted output

8.3.5 Unformatted text input

8.4 String processing and conversion

8.5 Time

8.6 Runtime environment settings

8.7 Program termination and assertions


LEVEL 2 Cognition

9 Style

9.1 Formatting

9.2 Naming


10 Organization and documentation

10.1 Interface documentation

10.2 Implementation

10.2.1 Macros

10.2.2 Pure functions


11 Pointers

11.1 Pointer operations

11.2 Pointers and structures

11.3 Pointers and arrays

11.3.1 Array and pointer access are the same

11.3.2 Array and pointer parameters are the same

11.4 Function pointers


12 The C memory model

12.1 A uniform memory model

12.2 Unions

12.3 Memory and state

12.4 Pointers to unspecific objects

12.5 Explicit conversions

12.6 Effective types

12.7 Alignment


13 Storage

13.1 malloc and friends

13.1.1 A complete example with varying array size

13.1.2 Ensuring consistency of dynamic allocations

13.2 Storage duration, lifetime, and visibility

13.2.1 Static storage duration

13.2.2 Automatic storage duration

13.3 Digression: using objects "before" their definition

13.4 Initialization

13.5 Digression: a machine model


14 More involved processing and IO

14.1 Text processing

14.2 Formatted input

14.3 Extended character sets

14.4 Binary streams

14.5 Error checking and cleanup


LEVEL 3 Experience

15 Performance

15.1 Inline functions

15.2 Using restrict qualifiers

15.3 Measurement and inspection


16 Function-like macros

16.1 How function-like macros work

16.2 Argument checking

16.3 Accessing the calling context

16.4 Default arguments

16.5 Variable-length argument lists

16.5.1 Variadic macros

16.5.2 A detour: variadic functions

16.6 Type-generic programming


17 Variations in control flow

17.1 A complicated example

17.2 Sequencing

17.3 Short jumps

17.4 Functions

17.5 Long jumps

17.6 Signal handlers


18 Threads 325

18.1 Simple inter-thread control

18.2 Race-free initialization and destruction

18.3 Thread-local data

18.4 Critical data and critical sections

18.5 Communicating through condition variables

18.6 More sophisticated thread management


19 Atomic access and memory consistency

19.1 The ``happened before'' relation

19.2 C library calls that provide synchronization

19.3 Sequential consistency

19.4 Other consistency models


What's inside

  • Operators and functions
  • Pointers, threading, and atomicity
  • C’s memory model
  • Hands-on exercises

About the reader

For programmers comfortable writing simple programs in a language like Java, Python, Ruby, C#, C++, or C.

About the author

Jens Gustedt is a senior scientist at the French National Institute for Computer Science and Control (INRIA) and co-editor of the ISO C standard.

placing your order...

Don't refresh or navigate away from the page.
print book $35.99 $59.99 pBook + eBook + liveBook
Additional shipping charges may apply
Modern C (print book) added to cart
continue shopping
go to cart

eBook $38.39 $47.99 3 formats + liveBook
Modern C (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.
customers also reading

This book 1-hop 2-hops 3-hops

FREE domestic shipping on three or more pBooks