Table of Contents
Introduction
How is C Code Compiled ?
Eclipse vs Visual Studio Code: What are the differences?
Microsoft Visual Studio and Microsoft VSCode
Brief History of C and the C standards
Fundamental Data Types
C Integer Types
The ASCII Character Set and C
ASCII character literals
Generalised Escape Sequences
Hex Escape Sequences
Octal Escape Sequences
Literal Integer Constants
Floating Point Types
Floating point literal constants
Variables in C
Variable Types
Variable – Definition and Declaration
Summary of the Standard C Type Qualifiers
C – Stream Oriented I/O
Basic Formatted Output in C
Input and Output of Primitive Data Types in C
printf by Example
Printf - Field Formatting
A Basic C Program
C Preprocessor #define and #include
Basic C Operators
Integer Arithmetic in C
Floating Point Arithmetic in C
Mixed Floating Point and Integer Arithmetic in C
Precedence of Arithmetic Operators in C
Assignment Operator
Compound Assignment Operators
Increment and Decrement Operators
Equality and Relational Operators
Logical Operators
The C Operator Precedence Table
Shortcut Evaluation of Logical Expressions
Uses of Logical Expressions in C Programs
Functions and Function Prototypes
Functions – Concepts and Terminology
Calling and Evaluating Functions
Function Prototypes
Types of function
Functions with static Local Variables
Function Declarations and the Calling of Functions
Functions – Mini Exercises
Mechanics of function calls
Function Calls and the return statement
if, else and else-if Statements
Introduction to handling user input using scanf()
Exercise - Factorial Function
The Switch Statement
Exercise – SimpleCalculator
Iteration in C – while, do – while, and for loops
Example – Implementing a Menu using a while loop
While loop – mini exercises
The for loop (for statement)
Exercise Involving Iteration
break and continue statements in for loops, while loops,
do – while loops and switch statements
goto
The Comma operator
The Arithmetic Conditional Ternary Operator
Sizeof Operator
Sizeof Operator - Exercises
Arrays
Array CAN’T DO's
Multidimensional Arrays
Exercises in Array Manipulation
Passing Multidimensional Arrays to Functions
Pointers to Data and Pointers to Functions
Introduction to Pointers in C
Exercises - exploring pointer variable manipulation
Printing pointers
Strings and Pointers to char
Wide Characters and C
Pointer Arithmetic
Incrementing and Decrementing Pointers
Dereferencing a Pointer
Passing references to variables in C function arguments
Arrays and Pointers
How Arrays and Pointer Types Are Related in C
Examples of Working With Arrays and Pointers
Working with Strings in C
C Standard IO Functions for Getting Strings and Characters
C Standard IO Functions for Outputting (Putting)
Strings and Characters
C Functions for String Manipulation
fgets() and gets() in C Programming
Reading and Handling Command Line Arguments in C
Exercise Processing Command Line Arguments
Allocating and Managing Memory Dynamically in C
Function Pointers
Function Pointers and Callbacks
Function Pointers and Dispatch Tables
Function Pointers – Example Case Study and Exercise - Using pointers to functions to transform a vector array
Exercise – Indexing into Arrays
Data Structures in C
Structured Data Types in C
Declaring a Structure in C
Pointers to structs in C
Limitations of Operations on Structs
Extended Exercise – Data Structs
Working with Arrays of Structures and
Arrays of Pointers to Structures
Initializing an Array of Structures
Nesting of Structures
Structures Containing Pointers
enums
Specifying particular values for enums
Using enum with union
Type aliases and typedef
Opaque Structs
File I/O in C
Security Aspects of the C Standard Library Function Implementations in Windows
Working with files in C
Opening a file – File Opening Modes
Closing a File
Reading and writing to a text file
Reading and writing binary files
Example 1: Writing to a binary file using fwrite()
Example 2. Reading data from a binary file
Example 3. Getting data from a file using fseek()
Macros
Macros with arguments
Macros with Multiple arguments
Dangers of repeating arguments in macro expansion
Variadic macros – macros that may have a variable number of arguments
Macros vs. inline functions
Macros that include other macros
Specialized macros
Multiple expressions in a macro
Non-syntactic macros
Multiple statements in one macro
String expansion in macros
Big macros
Conditional compilation
The #if directive
Appendix A – Installing and Working with Visual Studio 2022 on Windows