Modern C for Absolute Beginners: A Friendly Introduction to the C Programming Language

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Learn the basics of C, the C standard library, and modern C standards. Complete with modern, up-to-date examples and screenshots, this new edition is fully updated and reworked with the latest C23 standards and features.

C is a language that is as popular today as it was decades ago. It can be used to program a microcontroller or to develop an entire operating system. Author Slobodan Dmitrović takes you on a journey through the C programming language, the standard library, and the C standards basics. Each chapter is the right balance of theory and code examples. 

Written in a concise and easy-to-follow manner, this book will provide you all the essentials needed to start programming in modern C.

What You Will Learn

  • Understand C programming language and C standard library fundamentals
  • Work with new C standards features
  • Study the basics of types, operators, statements, arrays, functions, and structs
  • Review the fundamentals of pointers, memory allocation, and memory manipulation
  • Take advantage of best practices in C

Who This Book Is For 

Beginner or novice programmers who wish to learn the C programming language. No prior programming experience is required.

Author(s): Slobodan Dmitrović
Edition: 2
Publisher: Apress
Year: 2024

Language: English
Commentary: Publisher EPUB | Published: 26 March 2024
Pages: xxi, 351
City: Berkeley, CA
Tags: C Programming Language; C Language; C; ANSI C; C20; Computer Science

Table of Contents
About the Author
About the Technical Reviewer
Acknowledgments
Introduction
Part I: The C Programming Language
Chapter 1: Introduction
1.1 What Is C?
1.2 What Is C Used For?
1.3 C Compilers
1.3.1 Installing Compilers
1.3.1.1 On Linux
1.3.1.2 On Windows
1.4 C Standards
Chapter 2: Our First Program
2.1 Function main()
2.2 Comments
2.3 Hello World
Chapter 3: Types and Declarations
3.1 Declarations
3.2 Introduction
3.3 Character Type
3.4 Integer Type
3.5 Floating-Point Types
3.5.1 float
3.5.2 double
3.5.3 long double
Chapter 4: Exercises
4.1 Hello World with Comments
4.1.1 Declaration
4.1.2 Definition
4.1.3 Outputting Values
Chapter 5: Operators
5.1 Introduction
5.2 Arithmetic Operators
5.3 Assignment Operator
5.4 Compound Assignment Operators
5.5 Relational Operators
5.6 Equality Operators
5.7 Logical Operators
5.8 Increment and Decrement Operators
5.9 Operator Precedence
Chapter 6: Expressions
6.1 Initialization
6.2 Type Conversion
Chapter 7: Statements
7.1 Introduction
7.2 Selection Statements
7.2.1 if
7.2.2 if-else
7.2.3 switch
7.3 Iteration Statements
7.3.1 while
7.3.2 do-while
7.3.3 for
Chapter 8: Exercises
8.1 Arithmetic Operations
8.2 Integral Division
8.3 Floating-Point Division and Casting
8.4 Equality Operator
8.5 Relational and Logical Operators
8.6 The switch Statement
8.7 Iteration Statements
Chapter 9: Arrays
9.1 Declaration
9.2 Subscript Operator
9.3 Array Initialization
9.4 Character Arrays
9.5 Multidimensional Arrays
9.6 Array Size and Count
Chapter 10: Pointers
10.1 Introduction
10.2 Declaration and Initialization
10.3 Pointers and Arrays
10.4 Pointer Arithmetics
10.5 Void Pointers
10.6 Pointer to Character Arrays
10.7 Arrays of Pointers
Chapter 11: Command-Line Arguments
Chapter 12: Exercises
12.1 Character Array
12.2 Array Elements
12.3 Pointer to an Existing Object
12.4 Pointers and Arrays
12.5 Pointer to a Character Array
12.6 Pointer Arithmetics
12.7 Array of Pointers
Chapter 13: Functions
13.1 Introduction
13.2 Function Declaration
13.3 Function Definition
13.4 Parameters and Arguments
13.4.1 Passing Arguments
Passing by Value
Passing by Pointer/Address
13.5 Return Statement
Chapter 14: Exercises
14.1 A Simple Function
14.2 Function Declaration and Definition
14.3 Passing Arguments by Value
14.4 Passing Arguments by Pointer/Address
14.5 Function – Multiple Parameters
Chapter 15: Structures
15.1 Introduction
15.2 Initialization
15.3 Member Access Operator
15.4 Copying Structures
15.5 Pointers to Structures
15.6 Self-Referencing Structures
15.7 Structures as Function Arguments
Chapter 16: Unions
Chapter 17: Conditional Expression
Chapter 18: Typedef
Chapter 19: Const Qualifier
Chapter 20: Enumerations
Chapter 21: Function Pointers
Chapter 22: Exercises
22.1 Structure Definition
22.2 Structure Typedef Alias
22.3 Structure Initialization
22.4 Pointers to Structures
22.5 Unions
22.6 Constants and Pointers
22.7 Constant Function Parameters
22.8 Enums
22.9 Pointers to Functions
Chapter 23: Preprocessor
23.1 #include
23.2 #define
23.3 #undef
23.4 Conditional Compilation
23.4.1 #if
23.4.2 #ifdef
23.4.3 #ifndef
23.5 Built-In Macros
23.6 Function-Like Macros
Chapter 24: Exercises
24.1 Define and Undefine a Macro
24.2 Conditional Compilation
24.3 Built-In Macros
24.4 Function Macros
Chapter 25: Dynamic Memory Allocation
25.1 malloc
25.2 calloc
25.3 realloc
Chapter 26: Storage and Scope
26.1 Scope
26.1.1 Local Scope
26.1.2 Global Scope
26.2 Storage
26.2.1 Automatic Storage Duration
26.2.2 Static Storage Duration
26.2.3 Allocated Storage Duration
Chapter 27: Exercises
27.1 Dynamic Memory Allocation
27.2 Dynamic Memory Allocation: Arrays
27.3 Dynamic Memory Resizing
27.4 Automatic and Allocated Storage
Chapter 28: Standard Input and Output
28.1 Standard Input
28.1.1 scanf
28.1.2 sscanf
28.1.3 fgets
28.2 Standard Output
28.2.1 printf
28.2.2 puts
28.2.3 fputs
28.2.4 putchar
Chapter 29: File Input and Output
29.1 File Input
29.2 File Output
Chapter 30: Exercises
30.1 Standard Input
30.2 Standard Output
Chapter 31: Header and Source Files
Part II: The C Standard Library
Chapter 32: Introduction to C Standard Library
32.1 String Manipulation
32.1.1 strlen
32.1.2 strcmp
32.1.3 strcat
32.1.4 strcpy
32.1.5 strstr
32.2 Memory Manipulation Functions
32.2.1 memset
32.2.2 memcpy
32.2.3 memcmp
32.2.4 memchr
32.3 Mathematical Functions
32.3.1 abs
32.3.2 fabs
32.3.3 pow
32.3.4 round
32.3.5 sqrt
32.4 String Conversion Functions
32.4.1 strtol
32.4.2 snprintf
Part III: Modern C Standards
Chapter 33: Introduction to C11 Standard
33.1 _Static_assert
33.2 The _Noreturn Function Specifier
33.3 Type Generic Macros Using _Generic
33.4 The _Alignof Operator
33.5 The _Alignas Specifier
33.6 Anonymous Structures and Unions
33.7 Aligned Memory Allocation: aligned_alloc
33.8 Unicode Support for UTF-16 and UTF-32
33.9 Bounds Checking and Threads Overview
33.9.1 Bounds-Checking Functions
33.9.2 Threads Support
Chapter 34: The C17 Standard
Chapter 35: The Upcoming C23 Standard
35.1 constexpr
35.2 Binary Integer Constants
35.3 true and false
35.4 nullptr
35.5 Empty initializer ={}
35.6 #embed
35.7 Attributes
35.8 No Parameters Function Declaration
35.9 The strdup Function
35.10 The memccpy Function
Part IV: Dos and Don’ts
Chapter 36: Do Not Use the gets Function
Chapter 37: Initialize Variables Before Using Them
Chapter 38: Do Not Read Out of Bounds
Chapter 39: Do Not Free the Allocated Memory Twice
Chapter 40: Do Not Cast the Result of malloc
Chapter 41: Do Not Overflow a Signed Integer
Chapter 42: Cast a Pointer to void* When Printing Through printf
Chapter 43: Do Not Divide by Zero
Chapter 44: Where to Use Pointers?
44.1 Pointers to Existing Objects
44.2 Pointers to Arrays
44.3 Pointers to String Constants
44.4 Pointers to Dynamically Allocated Memory
44.5 Pointers as Function Arguments
Chapter 45: Prefer Functions to Function-Like Macros
Chapter 46: static Global Names
Chapter 47: What to Put in Header Files?
47.1 Shared Macros
47.2 Function Declarations
47.3 Shared extern Variables and Constants
47.4 Other Header Files
Part V: Appendices
Appendix A: Linkage
Appendix B: Time and Date
Appendix C: Bitwise Operators
C.1 The Bitwise NOT Operator ~
C.2 Bitwise Shift Operators << and >>
C.3 The Bitwise AND Operator &
Appendix D: Numeric Limits
D.1 Integer Types Limits
D.2 Floating-Point Types Limits
Appendix E: Summary and Advice
E.1 What to Learn Next?
E.2 Online References
E.3 Other C Books
E.4 Advice
Index