Introduction to C Programming for Computer Science Student Projects
$12.50
Minimum price
$18.50
Suggested price

Introduction to C Programming for Computer Science Student Projects

Part 1. Windows Version Getting Started by coding and running programs in Windows using Visual Studio

About the Book

This is one of a collection of workbooks developed for A Level and Undergraduate students needing to gain and consolidate knowledge relevant to a practical computing project. They have grown out of tutoring and teaching neuro diverse students who have been drawn to C and C++, as well as undergraduate and graduate students who have run into difficulties with programming more advanced applications in these languages. It can also be used by professional developers.

 

C is mainly used in embedded systems found in applications such as implementation of small sensor and controller based systems, Digital Signal Processing (DSP) applications, networked devices such as those found in IoT (Internet of Things) devices and also in the implementation of low level Linux and Windows applications, to name but a few. C is also used in the implementation of Linux Kernel Loadable Modules and device drivers and in low level Microsoft Windows applications.

 

Before starting to write code to run on target systems it is a good idea to master C programming building console based applications that to gain a good understanding of the C language itself, and, also to gain practice with topics such as arrays, function pointers, data structures, pointers and function pointers and the C Standard Library. Having mastered these skills the path is clear for moving on to more advanced topics such as data structures and algorithms, statemachines, working with operating system APIs, such as the Posix API in the case of Linux, and building embedded systems applications, both bare metal and those using an RTOS such as FreeRTOS or Zephyr.

 

 

About the Author

Table of Contents

@page { size: 21cm 29.7cm; margin: 2cm } p { line-height: 115%; margin-bottom: 0.25cm; background: transparent }

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

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub