• Complain

Harry Fairhead - Fundamental C: Getting Closer to the Machine

Here you can read online Harry Fairhead - Fundamental C: Getting Closer to the Machine full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2019, publisher: I/O Press, genre: Home and family. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Fundamental C: Getting Closer to the Machine
  • Author:
  • Publisher:
    I/O Press
  • Genre:
  • Year:
    2019
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Fundamental C: Getting Closer to the Machine: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Fundamental C: Getting Closer to the Machine" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

C is a good language to learn. It was designed to do a very different job from most modern languages and the key to understanding it is not to just understand the code, but how this relates to the hardware.

Fundamental C takes an approach that is close to the hardware, introducing addresses, pointers, and how things are represented using binary. An important idea is that everything is a bit pattern and what it means can change. As a C developer you need to think about the way data is represented, and Harry Fairhead encourages this. He emphasizes the idea of modifying how a bit pattern is treated using type punning and unions. This power brings with it the scourge of the C world undefined behavior - which is ignored in many books on C. Here, not only is it acknowledged, it is explained together with ways to avoid it.

A particular feature of the book is the way C code is illustrated by the assembly language it generates. This helps you understand why C is the way it is.

For beginners, the book covers installing an IDE and GCC before writing a Hello World program and then presents the fundamental building blocks of any program - variables, assignment and expressions, flow of control using conditionals and loops.

Once the essentials are in place, data types are explored before looking at arithmetic and representation. Harry then goes deeper into evaluating expressions before looking at functions and their scope and lifetime. Arrays, strings, pointers and structs are covered in separate chapters, as is bit manipulation, a topic that is key to using C, and the idea of a file as the universal approach to I/O. Finally, he looks at the four stages of compilation of a C program, the use of static and dynamic libraries and make.

This is C as it was always intended to be written - close to the metal.

Harry Fairhead has a hardware background and, having worked with microprocessors and electronics in general, for many years, he is an enthusiastic proponent of the IoT. His recent titles include Raspberry Pi IoT in C and Micro:bit IoT in C. His next, Applying C For The IoT With Linux at intermediate/advanced level is intended as a companion to this book for those working in a Linux/POSIX environment, in particular the Raspberry Pi.

Harry Fairhead: author's other books


Who wrote Fundamental C: Getting Closer to the Machine? Find out the surname, the name of the author of the book and a list of all author's works by series.

Fundamental C: Getting Closer to the Machine — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Fundamental C: Getting Closer to the Machine" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make

Fundamental C:

Getting Closer To The Machine

First Edition

Harry Fairhead

I/O Press

I Programmer Library

Copyright 2019 IO Press

All rights reserved. This book or any portion thereof may not be reproduced or used in any manner whatsoever without the express written permission of the publisher except for the use of brief quotations in a book review.

Harry Fairhead Fundamental C: Getting Closer To The Machine.

1st Edition

ISBN Paperback: 978-1871962604

First Printing, 2019

Revision 1

Published by IO Press

www.iopress.info

In association with I Programmer

www.i-programmer.info

The publisher recognizes and respects all marks used by companies and manufacturers as a means to distinguish their products. All brand names and product names mentioned in this book are trade marks or service marks of their respective companies and our omission of trade marks is not an attempt to infringe on the property of others.

Preface

C is a classic language and it is still an important language. This is because it is closer to the machine than other languages, but it still has enough abstraction for you to create programs that are more or less portable. Perhaps more important, it means you dont have to learn a new assembly language every time you switch hardware. So learn C and gain the advantage of its speed, simplicity and stay close to the metal. This approach is essential if you are going to create programs for the IoT or embedded processors, but it is also relevant to any program that makes direct use of hardware.

Most books on C treat it as if it was just a slightly different take on Java, or some other high-level language. C isnt Java with limited facilities. It is designed to do a very different job from most modern languages. The key to understanding C is not to just understand the language, what the specifications say, but how this relates to the hardware. C is only a logically constructed language when seen in terms of how it relates to the hardware.

For this reason it needs its own approach.

But what is that approach?

Low-level code works with the underlying representations of the data at the level of bits. In languages such as Java, Python and so on you dont often question how the data is stored or represented, but the creation of low-level C

code does just this. You need to know about addresses, pointers and how things are represented using just binary. Dealing with such topics also brings us into contact with the scourge of the C world undefined behavior. This cannot be ignored, as it is in so many other books on C, and here not only is it acknowledged, it is explained together with ways to avoid it.

C is a simple language and lends itself to being introduced in simple ways, but the simple constructs of C can be put together in ways that produce something complex or at least unexpected. I have tried to indicate how the simple parts of C are combined to make it more powerful than you might expect and how to avoid going too far and making it so obscure that it is difficult to understand.

In this book the emphasis is on standard C. If you want to know more about using C on POSIX-compliant and Linux-based systems, this is covered in its companion volume, Applying C For The IoT With Linux ISBN: 978-1871962611.

Harry Fairhead

March 2019

This book is a revised and updated version of the series of articles on the I Programmer website: www.i-programmer.info

To keep informed about forthcoming titles visit the I/O Press website: www.iopress.info . This is also where you will also find any errata and update information. You can also provide feedback to help improve future editions.

Table of Contents

Chapter 1
11

About C

Why C?...............................................................................................11

Standards and C................................................................................13

Platform Dependent or Independent Undefined Behavior...........14

Safe Coding........................................................................................16

Summary...........................................................................................17

Chapter 2
19

Getting Started

NetBeans and GCC............................................................................19

NetBeans C/C++ Under Linux and Windows.................................20

Installing GCC...................................................................................21

A First Program.................................................................................22

Using Tool Collections......................................................................24

Remote C/C++ Build Servers...........................................................25

Creating a Hello World Program.......................................................29

From the Command Line..................................................................30

Summary...........................................................................................31

Chapter 3
33

Control Structures and Data

Variables, assignment and expressions............................................33

Program Structure.............................................................................35

Comments..........................................................................................36

The Flow of Control..........................................................................37

The Conditional................................................................................40

The Compound Statement................................................................41

Loops..................................................................................................42

Flow of Control in Practice...............................................................52

Fractional Loops Break and Continue...........................................55

Nesting...............................................................................................56

The Switch Statement.......................................................................57

Summary...........................................................................................61

Chapter 4

Variables

Memory Basics..................................................................................64

The Numeric Data Types..................................................................65

The char Type...................................................................................66

Working With Boolean values..........................................................67

Floating Point....................................................................................67

Complex Numbers.............................................................................68

Declaring Variables...........................................................................68

Initialization......................................................................................69

Literals...............................................................................................71

Implementing Variables....................................................................72

Exact Size Variables..........................................................................73

Type Modifiers..................................................................................74

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Fundamental C: Getting Closer to the Machine»

Look at similar books to Fundamental C: Getting Closer to the Machine. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Fundamental C: Getting Closer to the Machine»

Discussion, reviews of the book Fundamental C: Getting Closer to the Machine and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.