Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Extreme C
  • Table Of Contents Toc
Extreme C

Extreme C

By : Kamran Amini
4.5 (29)
close
close
Extreme C

Extreme C

4.5 (29)
By: Kamran Amini

Overview of this book

There’s a lot more to C than knowing the language syntax. The industry looks for developers with a rigorous, scientific understanding of the principles and practices. Extreme C will teach you to use C’s advanced low-level power to write effective, efficient systems. This intensive, practical guide will help you become an expert C programmer. Building on your existing C knowledge, you will master preprocessor directives, macros, conditional compilation, pointers, and much more. You will gain new insight into algorithm design, functions, and structures. You will discover how C helps you squeeze maximum performance out of critical, resource-constrained applications. C still plays a critical role in 21st-century programming, remaining the core language for precision engineering, aviations, space research, and more. This book shows how C works with Unix, how to implement OO principles in C, and fully covers multi-processing. In Extreme C, Amini encourages you to think, question, apply, and experiment for yourself. The book is essential for anybody who wants to take their C to the next level.
Table of Contents (27 chapters)
close
close
24
Other Books You May Enjoy
25
Leave a review - let other readers know what you think
26
Index

To get the most out of this book

As we have explained before, this book requires you to have a minimum level of knowledge and skill regarding computer programming. The minimum requirements are listed below:

  • General knowledge of computer architecture: You should know about memory, CPU, peripheral devices and their characteristics, and how a program interacts with these elements in a computer system.
  • General knowledge of programming: You should know what an algorithm is, how its execution can be traced, what source code is, what binary numbers are, and how their related arithmetic works.
  • Familiarity with using the Terminal and the basic shell commands in a Unix-like operating system such as Linux or macOS.
  • Intermediate knowledge about programming topics such as conditional statements, different kinds of loops, structures or classes in at least one programming language, pointers in C or C++, functions, and so on.
  • Basic knowledge about OOP: This is not mandatory because we will explain OOP in detail, but it can help you to have a better understanding while reading the chapters in third part of the book, Object Orientation.

In addition, it is strongly recommended to download the code repository and follow the commands given in the shell boxes. Please use a platform with Linux or macOS installed. Other POSIX-compliant operating systems can still be used.

Download the example code files

You can download the example code files for this book from your account at www.packt.com/. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

  1. Log in or register at http://www.packt.com.
  2. Select the Support tab.
  3. Click on Code Downloads.
  1. Enter the name of the book in the Search box and follow the on-screen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Extreme-C. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Conventions used

In this book, we have used code boxes and shell boxes. Code boxes contain a piece of either C code or pseudo-code. If the content of a code box is brought from a code file, the name of the code file is shown beneath the box. Below, you can see an example of a code box:

#include <stdio.h>
#include <unistd.h>
int main(int argc, char** argv) {
  printf("This is the parent process with process ID: %d\n",
          getpid());
  printf("Before calling fork() ...\n");
  pid_t ret = fork();
  if (ret) {
    printf("The child process is spawned with PID: %d\n", ret);
  } else {
    printf("This is the child process with PID: %d\n", getpid());
  }
  printf("Type CTRL+C to exit ...\n");
  while (1);
  return 0;
}

Code Box 17-1 [ExtremeC_examples_chapter17_1.c]: Creating a child process using fork API

As you can see, the above code can be found in the ExtremeC_examples_chapter17_1.c file, as part of the code bundle of the book, in the directory of Chapter 17, Process Execution. You can get the code bundle from GitHub at https://github.com/PacktPublishing/Extreme-C.

If a code box doesn't have an associated filename, then it contains pseudo-code or C code that cannot be found in the code bundle. An example is given below:

Task P {
    1. num = 5
    2. num++
    3. num = num – 2
    4. x = 10
    5. num = num + x
}

Code Box 13-1: A simple task with 5 instructions

There can sometimes be some lines shown in bold font within code boxes. These lines are usually the lines of code that are discussed before or after the code box. They are in bold font in order to help you find them more easily.

Shell boxes are used to show the output of the Terminal while running a number of shell commands. The commands are usually in bold font and the output is in the normal font. An example is shown below:

$ ls /dev/shm
shm0
$ gcc ExtremeC_examples_chapter17_5.c -lrt -o ex17_5.out
$ ./ex17_5.out
Shared memory is opened with fd: 3
The contents of the shared memory object: ABC
$ ls /dev/shm
$

Shell Box 17-6: Reading from the shared memory object created in example 17.4 and finally removing it

The commands start either with $ or #. The commands starting with $ should be run with a normal user, and the commands starting with # should be run with a super user.

The working directory of a shell box is usually the chapter directory found in the code bundle. In cases when a particular directory should be chosen as the working directory, we give you the necessary information regarding that.

Bold: Indicates a new term, an important word. Words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this. For example: "Select System info from the Administration panel."

Warnings or important notes appear like this.

Tips and tricks appear like this.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Extreme C
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon