Index

A note on the digital index

A link in an index entry is displayed as the section title in which that entry appears. Because some sections have multiple index markers, it is not unusual for an entry to have several links to the same section. Clicking on any link will take you directly to the place in the text in which the marker appears.

Symbols

! (exclamation mark), not operator, There’s more to booleans than equals...
# (hash mark), beginning preprocessor directives, #2. Preprocessor directives
$ (dollar sign), $%, $^, and $@ compiler commands for makefiles, #7. More on make
% (percent sign)
%li format string, Using memory pointers
%p format string, Using memory pointers, Using memory pointers
& (ampersand)
&& (logical AND) operator, There’s more to booleans than equals..., ! flips the value of a condition
bitwise AND operator, ! flips the value of a condition, Bit twiddling
reference operator, Digging into memory, Using memory pointers
( ) (parentheses), caution with, when using structs, You need a pointer to the struct
* (asterisk)
accessing array elements, Why arrays really start at 0
in variable declarations, If you’re going to change a string, make a copy
indirection operator, Using memory pointers
+ (plus sign)
++ (increment) operator, The program works!, #1. Operators
+= (addition and assignment) operators, The program works!
, (comma)
separating expressions, Bit twiddling
separating values in enums, An enum variable stores a symbol
- (minus sign)
-- (decrement) operator, The program works!, #1. Operators
-= (subtraction and assignment) operator, The program works!
negative numbers and command-line arguments, Let the library do the work for you
prefacing command-line options, Let the library do the work for you
-> pointer notation, (*t).age vs. *t.age, (*t).age vs. *t.age
. (dot) operator, reading struct fields, Read a struct’s fields with the “.” operator
. dot notation, setting value of unions, How do you use a union?
... (ellipsis), So how can YOU do that?
/ (slash)
/* and */ surrounding comments, But what does a complete C program look like?
// beginning comments, But what does a complete C program look like?
32-bit operating systems, Use casting to put floats into whole numbers
size of pointers, Array variables are like pointers...
64-bit operating systems, Use casting to put floats into whole numbers
size of pointers, Array variables are like pointers...
8-bit operating systems, Use casting to put floats into whole numbers
; (semicolon), separating values in structs and unions, An enum variable stores a symbol
< > (angle brackets)
>> (bitwise shift left) operator, Bit twiddling
in header files, Creating your first header file, Code you can take to the bank
redirecting Standard Input with <, You can redirect the Standard Input with <...
redirecting Standard Output with >, ...and redirect the Standard Output with >, Redirecting input and output
redirection using > and 2> operators, Redirection just replaces data streams
= (equals sign)
== (equality) operator, The program works!
assignment operator, The program works!
? (question mark), #1. Operators
?: (ternary) operator, #1. Operators
[ ] (square brackets)
array subindex operator, Why arrays really start at 0
creating arrays and accessing elements, It’s time for a code review
in variable declarations, If you’re going to change a string, make a copy
sentinel character, The program works!
^ (caret), bitwise XOR operator, Bit twiddling
_ (underscore), replacing spaces in web page name, Create a socket for a domain name
{ } (curly braces)
enclosing function body, But what does a complete C program look like?
enclosing statements, Two types of command
| (pipe symbol)
bitwise OR operator, ! flips the value of a condition, Bit twiddling
connecting input and output with a pipe, Connect your input and output with a pipe
|| (logical OR) operator, There’s more to booleans than equals..., ! flips the value of a condition
~ (tilde), bitwise complement operator, Bit twiddling
‘’ (quotation marks, single) in strings, The program works!
“” (quotation marks, double)
enclosing strings, The program works!
in header files, Creating your first header file, Code you can take to the bank

A

accept( ) function, 2. Listen
AceUnit framework, #5. Automated testing
alarm signal, SIGALRM, Sending your code a wake-up call
alarm( ) function, Sending your code a wake-up call
calls to, resetting the timer, ...the timer fires a SIGALRM signal
sleep( ) function and, Sending your code a wake-up call
Allegro library, Allegro
creation of game elements, What does Allegro do for you?
AND operator (&&), There’s more to booleans than equals..., ! flips the value of a condition
AND operator (&), ! flips the value of a condition, Bit twiddling
animation, using transformations, Use transformations to move things around
ANSI C, C is a language for small, fast programs
Arduino
Arduino board, The Arduino
building the physical device, Build the physical device
C code for, what it does, Here’s what your code should do
finished product, The finished product
plant monitor and moisture sensor, The spec: make your houseplant talk
useful functions, Here are some useful Arduino functions
writing C code in Arduino IDE, The Arduino
args parameter, So how can YOU do that?
arguments, function, ...and continue to continue
fixed argument in variadic functions, So how can YOU do that?, So how can YOU do that?
array functions, execv( ), execvp( ), and execve( ), The array functions: execv(), execvp(), execve()
array variables
differences from pointers, But array variables aren’t quite pointers
use as pointers, Array variables are like pointers...
arrays, The program works!
array of arrays versus array of pointers, It’s time for a code review
assigned to pointers, pointer decay and, But array variables aren’t quite pointers
char pointers versus char arrays in data structure, Let’s fix the code using the strdup() function
creating array of arrays, Create an array of arrays, It’s time for a code review
fixed length of, Do you need flexible storage?
indexes, The program works!, Why arrays really start at 0
length of, The program works!
linked lists versus, Inserting values into the list
of function pointers, Create an array of function pointers
strings as character arrays, The program works!
structs versus, Create your own structured data types with a struct, Read a struct’s fields with the “.” operator
using to copy string literals, If you’re going to change a string, make a copy
variables declared as, If you’re going to change a string, make a copy
Assembly language, translation of C code into, Compilation behind the scenes
assignments
= (assignment) operator, The program works!
chaining, ...and continue to continue
compound assignment operators, The program works!
struct assigned to another variable, Read a struct’s fields with the “.” operator
struct to another struct, The code is cloning the turtle
associated arrays or maps, Free the memory when you’re done
asteroids (Blasteroids game), The asteroid
autoconf tool, Tell make about your code with a makefile
automated testing, #5. Automated testing
automating builds with make tool, Automate your builds with the make tool

B

binary literals, not supported in C, Sometimes you want control at the bit level, Bitfields store a custom number of bits
binary numbers, Don’t put something big into something small
binary trees, Free the memory when you’re done
binary values, converting between hexadecimal and, Sometimes you want control at the bit level
binding to a port, BLAB: how servers talk to the Internet
bit size of computers, Use casting to put floats into whole numbers
bitfields, Bitfields store a custom number of bits, Bitfields store a custom number of bits, Unions and bitfields
using to construct customer satisfaction survey (example), Bitfields store a custom number of bits
bits, operators for manipulation of, Bit twiddling
bitwise AND operator (&), ! flips the value of a condition, Bit twiddling
bitwise complement operator (~), Bit twiddling
bitwise OR operator (|), ! flips the value of a condition, Bit twiddling
bitwise shift left operator (<<), Bit twiddling
bitwise XOR operator (^), Bit twiddling
BLAB: Bind, Listen, Accept, Begin, BLAB: how servers talk to the Internet
Blasteroids game (see game, Blasteroids project)
blasts fired by spaceship (Blasteroids game), The blast
block statements, Two types of command
body of a function, But what does a complete C program look like?
boolean operators, There’s more to booleans than equals...
boolean values, representation in C, There’s more to booleans than equals...
bound port, reuse by socket, Why your mom always told you to check for errors
break statements, Pulling the ol’ switcheroo, Pulling the ol’ switcheroo, ...and continue to continue
exiting loops, You use break to break out...
not breaking out of if statements, You use break to break out...
buffer overflows caused by scanf( ) function, Be careful with scanf()
build tools, Tell make about your code with a makefile
CMake, Allegro
bus errors, The program works!

C

C
basics of, Basics
how it works, C is a language for small, fast programs
reference materials for programming, #10. Reference material
similarities to and influence on other languages, ...and continue to continue
C Standard Library, Let’s update the code to use fprintf()
C++, ...and continue to continue
C11 standard, C is a language for small, fast programs
c89 notation for first field of a union, How do you use a union?
C99 standard, C is a language for small, fast programs
cameras
grabbing image from webcam, What your code should do
showing current webcam output, Detect an intruder
taking input from computer camera, What your code should do
Carbon libraries, #9. Creating GUIs
card counting, Card counting? In C?
modifying program to keep running count of card game, ...and continue to continue
program for, writing in C, Card counting? In C?, ! flips the value of a condition
testing program, ...and continue to continue
case statements, Pulling the ol’ switcheroo, Pulling the ol’ switcheroo
casting floats to whole numbers, Use casting to put floats into whole numbers
chaining assignments, ...and continue to continue
char type, Using Multiple Source Files: Break it down, build it up, Using Multiple Source Files: Break it down, build it up
arithmetic with, If you have common features...
char pointers versus char arrays in data structure, Let’s fix the code using the strdup() function
defined, Using Multiple Source Files: Break it down, build it up
char** pointer, How to create function pointers, Use function pointers to set the order
checksum( ) function, Code you can take to the bank
child process, exec() is the end of the line for your program, Opening a web page in a browser
clients talking to server, You can fork() a process for each client
listening to directly, Stay in touch with your child
piped commands on command line, Connect your processes with pipes
redirecting Standard Output to file, dup2() duplicates data streams
running with fork( ) and exec( ), Running a child process with fork() + exec()
classes, structs versus, Read a struct’s fields with the “.” operator
CMake, Allegro
Cocoa libraries, #9. Creating GUIs
collisions, The spaceship
comma (,), separating expressions, Bit twiddling
comma-separated data, reading and displaying in JSON format, Small tools can solve big problems
command line, piping commands together on, Connect your processes with pipes
command path, Most system calls go wrong in the same way
command-line arguments
avoiding ambiguity by splitting main arguments from options using --, Let the library do the work for you
execl( ), execlp( ), and execle( ) functions, There are many exec() functions
main( ) function with, There’s more to main()
command-line options, Overheard at the Head First Pizzeria
questions and answers on, Let the library do the work for you
using getopt( ) function for, Let the library do the work for you
commands, types of, Two types of command
comments, But what does a complete C program look like?
formatting, But what does a complete C program look like?
comparator functions, Use function pointers to set the order
writing for different sort descriptions, Use function pointers to set the order
compilation, C is a language for small, fast programs
automating builds with make tool, Automate your builds with the make tool
behind-the-scenes look at, Compilation behind the scenes
compiling a program using gcc, But how do you run the program?
partial compiles, First, compile the source into object files
precompilation and, Creating your first header file
reason for compiling C, ...and continue to continue
speeding up for programs in multiple source files, It’s not rocket science...or is it?
compiled code, saving copies of, Don’t recompile every file
compilers, But how do you run the program?
(see also gcc)
BE the Compiler exercise, ! flips the value of a condition
C standard supported by, But what does a complete C program look like?
debug information from, The leak is fixed
finding standard header file directories, Angle brackets are for standard headers
interview with gcc, ! flips the value of a condition
conditional compilation, #2. Preprocessor directives
connection, accepting from client, 2. Listen
const char, Sometimes you need to hand around a lot of data, Create your own structured data types with a struct
const keyword, If you’re going to change a string, make a copy, If you’re going to change a string, make a copy
constants
defined, Memory memorizer
string literals as, String literals can never be updated
continue statements, You use break to break out..., ...and continue to continue
control statements, Two types of command
convert command, Opening a web page in a browser
count variable, #3. The static keyword
create( ) function, using dynamic allocation, Oh, no! It’s the out-of-work actors..., Oh, no! It’s the out-of-work actors...
fixing with strdup( ) function, Let’s fix the code using the strdup() function
CreateProcess( ) function (Windows systems), 2. If you’re the child process, call exec()
Ctrl-C, stopping programs, The death of a process
curl/wget programs, Opening a web page in a browser
cvCalcOpticalFlowFarneback( ) function, Detect an intruder
cvCreateCameraCapture( ) function, What your code should do
cvNamedWindow( ) function, Detect an intruder
cvQueryFrame( ) function, What your code should do
cvShowImage( ) function, Detect an intruder
Cygwin, Opening a web page in a browser
fork( ) function and, 2. If you’re the child process, call exec()
including PATH variable when passing environment variables on, Passing environment variables
installing before calling fork( ) on Windows, exec() is the end of the line for your program
telnet program, The Internet knock-knock server

D

data entry
capabilities of scanf( ) versus fgets( ), Using sizeof with fgets()
fgets( ) as alternative to scanf( ), fgets() is an alternative to scanf()
using pointers for, Using pointers for data entry
data streams
creating your own, Roll your own data streams
duplication with dup2( ) function, fileno() tells you the descriptor
handling in a typical process, A look inside a typical process
opening, checking for problems with, There’s more to main()
printing to, fprintf() prints to a data stream
replacement by redirection, Redirection just replaces data streams
sockets, BLAB: how servers talk to the Internet
summary of important points, Data streams
typical data streams versus sockets, A socket’s not your typical data stream
data structures
questions and answers about, Inserting values into the list
summary of important points, Data structures
types other than linked lists, Free the memory when you’re done
data types, Using Multiple Source Files: Break it down, build it up
bytes in memory occupied by, getting with sizeof, Ask for memory with malloc()...
casting floats to whole numbers, Use casting to put floats into whole numbers
data not having single type, Sometimes the same type of thing needs different types of data
errors caused by conflicting types in example program, Let’s see what’s happened to the code
macros determining size of, #4. How big stuff is
matching type of value to type of variable it’s stored in, Don’t put something big into something small
no function data type in C, ...but there’s no function data type
parameters in variadic functions, So how can YOU do that?
pointer variables, Why arrays really start at 0
prefixing with unsigned or long keywords, Use casting to put floats into whole numbers
process ID, 2. If you’re the child process, call exec()
quick guide to, Using Multiple Source Files: Break it down, build it up
size of, Use casting to put floats into whole numbers
sizes on different operating systems, Use casting to put floats into whole numbers
structs, Create your own structured data types with a struct
summary of, Data types
unions, Set the value with dot notation
values stored in unions, unions are often used with structs
deadlocks, Use a mutex as a traffic signal
debugger, gdb, #8. Development tools
decay, But array variables aren’t quite pointers
decimal point numbers, Using Multiple Source Files: Break it down, build it up
(see also floating-point numbers; float type)
computers’ representation of, Use casting to put floats into whole numbers
declarations
defined, If you’re going to change a string, make a copy
function, splitting from definition, Split the declaration from the definition, Multiple files
decrement operator (--), The program works!, #1. Operators
#define directive, #2. Preprocessor directives
definitions, function, splitting from declaration, Split the declaration from the definition, Multiple files
dependencies, Automate your builds with the make tool
identifying for make tool, How make works
dereferencing, Using memory pointers, Using memory pointers
descriptor table
important points about, The waitpid() function
Standard Input, Output, and Error in, Redirection just replaces data streams
design tips for small tools, Don’t change the geo2json tool
designated initializers, How do you use a union?, Bitfields store a custom number of bits
setting initial values of struct fields, Set the value with dot notation
/dev/tty program, The waitpid() function
development tools, #8. Development tools
device drivers, Security’s not the only problem
DNS (domain name system), getaddrinfo() gets addresses for domains
do-while loops, Sometimes once is not enough..., ...and continue to continue
domain names, Clients are in charge
connecting client socket to remote domain name, Create a socket for an IP address
creation of sockets with IP addresses or domain names, Create a socket for a domain name
double type, Using Multiple Source Files: Break it down, build it up, Using Multiple Source Files: Break it down, build it up
defined, Using Multiple Source Files: Break it down, build it up
doubly linked lists, Free the memory when you’re done
dup2( ) function, fileno() tells you the descriptor
dynamic libraries, Static and Dynamic Libraries: Hot-swappable code, Static and dynamic libraries
dynamic memory, Dynamic memory
dynamic storage, Inserting values into the list, Free the memory when you’re done
using the heap, Use the heap for dynamic storage

E

echo command, System calls are your hotline to the OS
ellipsis (...), So how can YOU do that?
email, sending from command line, Opening a web page in a browser
encrypt( ) function, Code you can take to the bank
encryption, XOR, If you have common features...
enums, An enum variable stores a symbol, An enum variable stores a symbol
responses in mail merge program (example), Automating the Dear John letters
tracking values stored in structs and unions, An enum variable stores a symbol
environment variables
parameters for execv( ), execvp( ), and execve( ) functions, The array functions: execv(), execvp(), execve()
parameters for exel( ), execlp( ), and execle( ) functions, There are many exec() functions
reading and passing to functions, Passing environment variables
equality operator (==), The program works!
errno variable, Most system calls go wrong in the same way
error handling, avoiding writing duplicate code for system calls, dup2() duplicates data streams
error messages
converting errno into, Most system calls go wrong in the same way
displaying when Standard Output is redirected, But there’s a problem with some of the data...
Standard Error, Introducing the Standard Error
/etc/services file, A socket’s not your typical data stream
.exe files (Windows), But how do you run the program?
exec( ) functions, The exec() functions give you more control, Your C Toolbox
array functions, execv( ), execvp( ), and execve( ), The array functions: execv(), execvp(), execve()
failures of calls to, Most system calls go wrong in the same way
important points about, Most system calls go wrong in the same way
list functions, execl( ), execlp( ), and execle( ), There are many exec() functions
many versions of, There are many exec() functions
order-generation program, Starbuzz coffee (example), Most system calls go wrong in the same way
program searching many RSS feeds at once (example), Read the news with RSS
program termination after call to, exec() is the end of the line for your program
running /sbin/ifconfig or ipconfig (example), Most system calls go wrong in the same way
running child process with fork( ) and exec( ), Running a child process with fork() + exec()
execle( ) function, Passing environment variables
failures of, Most system calls go wrong in the same way
program searching many RSS feeds at once (example), Read the news with RSS
executables, C is a language for small, fast programs, Compilation behind the scenes
exit status of child process, The waitpid() function
exit( ) function, dup2() duplicates data streams
called by default signal handler for interrupt signal, The death of a process
important points about, The waitpid() function
extern keyword, The shared code needs its own header file

F

Feldman, Stuart, Tell make about your code with a makefile
fgets( ) function, Opening a web page in a browser, The death of a process
as alternative to scanf( ), fgets() is an alternative to scanf()
using for data input, scanf( ) versus, Using sizeof with fgets()
file descriptors, A look inside a typical process
descriptor tables, The waitpid() function
fileno( ) function, fileno() tells you the descriptor
files, making program work with, But you’re not using files...
filters, But you’re not using files...
find( ) function, Looking for Mr. Right...
other types of searches, How to create function pointers
float type, Using Multiple Source Files: Break it down, build it up
casting to whole numbers, Use casting to put floats into whole numbers
defined, Using Multiple Source Files: Break it down, build it up
finding size of, Use casting to put floats into whole numbers
floating-point numbers, Using Multiple Source Files: Break it down, build it up
handling with floats and doubles, Use casting to put floats into whole numbers
fopen( ) function, Roll your own data streams
problem opening data stream, There’s more to main()
for loops, Loops often follow the same structure..., ...and continue to continue
fork( ) function, exec() is the end of the line for your program, Your C Toolbox
creating a process for each client, You can fork() a process for each client
important points about, 2. If you’re the child process, call exec()
running child process with fork( ) + exec( ), Running a child process with fork() + exec()
calling fork( ), 2. If you’re the child process, call exec()
format strings, passing to scanf( ) function, Using pointers for data entry
formatted output, display by printf( ) function, But what does a complete C program look like?
fprintf( ) function, fprintf() prints to a data stream
updating example mapping program to use, Let’s update the code to use fprintf()
free( ) function, Give the memory back when you’re done
call interception by valgrind, The leak is fixed
releasing memory with, Ask for memory with malloc()...
tracking calls to with valgrind, Software forensics: using valgrind
freeaddrinfo( ) function, getaddrinfo() gets addresses for domains
fscanf( ) function, fprintf() prints to a data stream
functions, But what does a complete C program look like?, Advanced Functions: Turn your functions up to 11
advanced, summary of important points, Advanced functions
Arduino, Here are some useful Arduino functions
find( ) function, Looking for Mr. Right...
macros versus, So how can YOU do that?
main( ) function, But what does a complete C program look like?
no function data type in C, ...but there’s no function data type
operators versus, What the computer thinks when it runs your code
order in a program, Compilers don’t like surprises
order of running in a program, It’s time for a code review
passing as parameter to another function, You need to tell find() the name of a function
creating function pointers, How to create function pointers
identifying function pointers, How to create function pointers
passing code to, Pass code to a function
passing pointer to variable as function parameter, Try passing a pointer to the variable
passing strings to, How do you pass a string to a function?
passing struct to function that updates struct, The code is cloning the turtle
sorting data, Get it sorted with the C Standard Library
using function pointers to set sort order, Use function pointers to set the order
splitting declaration from definition, Split the declaration from the definition, Multiple files
variables declared inside, Digging into memory
variadic, Make your functions streeeeeetchy
writing example function, So how can YOU do that?
void return type, ...and continue to continue
writing, ...and continue to continue

G

game, Blasteroids project, C Lab 3: Blasteroids
Allegro library, Allegro
asteroids, The asteroid
blasting asteroids without being hit, Your mission: blast the asteroids without getting hit
blasts fired by spaceship, The blast
building the game, Building the game
finished product, The finished product
game status, How the asteroid moves
reading key presses, Reading keypresses
spaceship, The spaceship
spaceship behavior, Spaceship behavior
using transformations, Use transformations to move things around
writing arcade game, Write the arcade game Blasteroids
garbage collection, C and, Free the memory when you’re done
gcc, But how do you run the program?
-I option, Sharing .h header files
finding standard header file directories, Angle brackets are for standard headers
GNU Compiler Collection, ...and continue to continue
interview with, ! flips the value of a condition
optimizations, #6. More on gcc
standards supported, But what does a complete C program look like?
warnings, Warnings
gcov (GNU Coverage), #8. Development tools
gdb (GNU Project Debugger), #8. Development tools
GET command, Writing a web client
getaddrinfo( ) function, getaddrinfo() gets addresses for domains
getenv( ) function, Passing environment variables
getopt( ) function, Let the library do the work for you, Let the library do the work for you
gets( ) function, reasons not to use, fgets() is an alternative to scanf()
global variables, It’s time for a code review
count, #3. The static keyword
errno, Most system calls go wrong in the same way
storage in memory, Try passing a pointer to the variable
globals
defined, Memory memorizer
variables declared outside of functions, Digging into memory
GNU Compiler Collection (see gcc)
GNU Coverage (gcov), #8. Development tools
GNU Profiler (gprof), #8. Development tools
GNU Project Debugger (gdb), #8. Development tools
golden rules of failure, Most system calls go wrong in the same way
gprof (GNU Profiler), #8. Development tools
grep command, Connect your processes with pipes
GTK library, #9. Creating GUIs
GUIs (graphical user interfaces), creating, #9. Creating GUIs

H

hardware, kernel and, Security’s not the only problem
header files
angle brackets in, Code you can take to the bank
creating, Creating your first header file
for shared code, The shared code needs its own header file
forgetting to include, It’s time for a code review
function declarations in, Split the declaration from the definition
quotes and angle brackets in, Creating your first header file
sharing between programs, Angle brackets are for standard headers
heap
allocating and releasing memory, So does it fix the code?
allocating storage for string copy, Oh, no! It’s the out-of-work actors...
defined, Memory memorizer
differences from the stack, Free the memory when you’re done
important points about, Free the memory when you’re done
releasing memory when you’re done, Give the memory back when you’re done
using for dynamic storage, Use the heap for dynamic storage
hex format, memory addresses, Using memory pointers, Using memory pointers
hexadecimal literals, Sometimes you want control at the bit level
hexadecimals, converting between binary and, Sometimes you want control at the bit level
.h files (see header files)
hostname, Writing a web client
HTTP (Hypertext Transfer Protocol), Knock-knock server overview, Writing a web client

I

I/O (input/output)
connecting input and output with a pipe, Connect your input and output with a pipe
displaying error messages when output is redirected, But there’s a problem with some of the data...
output to more than one file, But what if you want to output to more than one file?
redirecting, Redirecting input and output
redirecting output from display to files, But you’re not using files...
redirecting Standard Input with < operator, You can redirect the Standard Input with <...
redirecting Standard Output with > operator, ...and redirect the Standard Output with >
redirection, You can use redirection
IDE, Arduino, The Arduino
if statements, Two types of command
break statements and, You use break to break out...
checking same value repeatedly, What’s the code like now?
replacing sequence of switch statement, Pulling the ol’ switcheroo
ignoring signals, ...the timer fires a SIGALRM signal
interrupt signal, Rewriting the code to use a signal handler
images
converting image formats, Opening a web page in a browser
grabbing image from webcam, What your code should do
#include directive, Compilation behind the scenes, #2. Preprocessor directives
angle brackets in, Code you can take to the bank
header files at different locations, Sharing .h header files
including header file in main program, Creating your first header file
includes section, C programs, But what does a complete C program look like?
increment operator (++), The program works!, #1. Operators
indexes, array, The program works!
starting at 0, Why arrays really start at 0
indirection operator (*), Using memory pointers
infinite loops, ...and continue to continue
int type, Using Multiple Source Files: Break it down, build it up
compiler assumption as return type for unknown functions, Compilers don’t like surprises, Creating your first header file
defined, Using Multiple Source Files: Break it down, build it up
finding size of, Use casting to put floats into whole numbers
integers, Using Multiple Source Files: Break it down, build it up
interprocess communication, Interprocess Communication: It’s good to talk
avoiding duplicate error-handling code for each system call, dup2() duplicates data streams
catching signals and running your own code, Catching signals and running your own code
connecting processes with pipes, Connect your processes with pipes
death of a process, The death of a process
duplicating data streams with dup2( ), fileno() tells you the descriptor
examining a typical process, A look inside a typical process
finding RSS news stories and opening them in a browser, Case study: opening stories in a browser
getting descriptor with fileno( ), fileno() tells you the descriptor
listening to child process directly, Stay in touch with your child
processes redirecting themselves, Redirection just replaces data streams
program saving output of rssgossip.py script to file, dup2() duplicates data streams
program testing math skills (example), ...the timer fires a SIGALRM signal
questions and answers about, The waitpid() function
redirecting input and output, Redirecting input and output
redirection replacing data streams, Redirection just replaces data streams
resetting and ignoring signals, ...the timer fires a SIGALRM signal
sending alarm signal to processes, Sending your code a wake-up call
summary of important points, Processes and communication
using kill command to send signals, Use kill to send signals
using raise( ) to send signals, Use kill to send signals
waitpid( ) function, Sometimes you need to wait...
interrupt signal, The death of a process
ignoring, Rewriting the code to use a signal handler
intruder detector, The spec: turn your computer into an intruder detector
finished product, The finished product
IP (Internet Protocol), Knock-knock server overview
IP (Internet Protocol) addresses, Clients are in charge
converting domain names to, getaddrinfo() gets addresses for domains
creating socket for an IP address, Create a socket for an IP address
creation of sockets with IP addresses or domain names, Create a socket for a domain name
ipconfig, Most system calls go wrong in the same way

J

JSON, displaying comma-separated data as, Small tools can solve big problems

K

kernel, Security’s not the only problem
keypresses, reading, Reading keypresses
kill command, using to send signals, Use kill to send signals

L

LED
C code writing to, Here’s what your code should do
connecting to Arduino board, Build the physical device
libraries
Allegro game development library, Allegro
GUI (graphical user interface), #9. Creating GUIs
static and dynamic, Static and dynamic libraries
limits.h header, macros defined in, #4. How big stuff is
linked lists, Linked lists are like chains of data
creating, Create a recursive structure
creating and releasing heap memory, So does it fix the code?
inserting values into, Inserting values into the list
linking object code files, Compilation behind the scenes, First, compile the source into object files
Linux, Opening a web page in a browser
(see also operating systems)
GTK GUI library, #9. Creating GUIs
list functions, execl( ), execlp( ), and execle( ), There are many exec() functions
listen queue for clients, 2. Listen
listen( ) function, 2. Listen
local variables, storage in stack, Try passing a pointer to the variable, Use the heap for dynamic storage
locks, You need to add traffic signals
creating a mutex lock, Use a mutex as a traffic signal
deciding where to put locks in code (example), Use a mutex as a traffic signal
long keyword, Use casting to put floats into whole numbers
long type, Using Multiple Source Files: Break it down, build it up, Using Multiple Source Files: Break it down, build it up
defined, Using Multiple Source Files: Break it down, build it up
passing long values to thread functions, Use a mutex as a traffic signal
LONG_MAX macro, #4. How big stuff is
loops
breaking out of with break statement, You use break to break out...
continue statement in, You use break to break out...
running forever, infinite loops, ...and continue to continue
structure of, Loops often follow the same structure...

M

Mac computers, Opening a web page in a browser
(see also operating systems)
Carbon library for GUIs, #9. Creating GUIs
script for talking to plants, The finished product
machine code, C is a language for small, fast programs, Compilation behind the scenes
macros, Roll your own data streams
creating, #2. Preprocessor directives
functions versus, So how can YOU do that?
mail/mutt programs, Opening a web page in a browser
main( ) function, But what does a complete C program look like?
ending program with exit( ) instead of, The waitpid() function
with command-line arguments, There’s more to main()
make tool, Automate your builds with the make tool, Read a struct’s fields with the “.” operator
additional features, #7. More on make
automating builds with, Automate your builds with the make tool
converting Ogg Vorbis music file to Swing version, Tell make about your code with a makefile
different name on Windows, How make works
how it works, How make works
implicit rules to build files, Implicit rules
uses other than compiling code, Tell make about your code with a makefile
makefiles, Tell make about your code with a makefile
generation with autoconf tool, Tell make about your code with a makefile
on different operating systems, Tell make about your code with a makefile
malloc( ) function, Use the heap for dynamic storage
asking for memory with, Ask for memory with malloc()...
call by strdup( ) function, Free the memory when you’re done
call interception by valgrind, The leak is fixed
tracking calls to with valgrind, Software forensics: using valgrind
memory, Memory and Pointers: What are you pointing at?, Dynamic memory
addresses, Try passing a pointer to the variable
allocating heap memory and releasing it, So does it fix the code?
and pointers, Pointers and memory
C toolbox, Your C Toolbox
differences between the stack and the heap, Free the memory when you’re done
freeing by calling free( ) function, Give the memory back when you’re done, Ask for memory with malloc()...
getting with malloc( ) function, Use the heap for dynamic storage
kernel control over, Security’s not the only problem
order of segments in, If you’re going to change a string, make a copy
overview of computer memory, Digging into memory
questions and answers about, Using memory pointers
requesting with malloc( ) function, Ask for memory with malloc()...
reuse of space with unions, A union lets you reuse memory space
string literals stored in read-only memory, String literals can never be updated
structs stored in, Read a struct’s fields with the “.” operator
summary of segments, Memory memorizer
memory leaks, Give the memory back when you’re done
avoding when using data structures, Free the memory when you’re done
tracking and fixing using valgrind tool, Software forensics: using valgrind
MinGW, spaces in command-line arguments, There are many exec() functions
mingw32-make, How make works
mkfifo( ) function, Opening a web page in a browser
moisture sensor
building, Build the physical device
C code reading from, Here’s what your code should do
connecting to Arduino, Connect the moisture sensor
movement, detecting, Detect an intruder
mutexes, You need to add traffic signals
causing deadlocks, Use a mutex as a traffic signal
creating a mutex lock, Use a mutex as a traffic signal

N

named pipes, Opening a web page in a browser
nested structs, Can you put one struct inside another?
network configuration, commands for, Most system calls go wrong in the same way
networking (see sockets and networking)
NMAKE tool, How make works
not operator (!), There’s more to booleans than equals...
NULL value, following last command-line argument in exec( ) function parameters, There are many exec() functions

O

object code, Compilation behind the scenes
saving copies into files, Don’t recompile every file
object files, sharing between programs, Angle brackets are for standard headers
object orientation, ...and continue to continue
Objective-C, ...and continue to continue, #9. Creating GUIs
.o files, Angle brackets are for standard headers
(see also object code)
Ogg Vorbis music file, converting to Swing version, Tell make about your code with a makefile
OpenCV
C code, what it should do, What your code should do
defined, OpenCV
finished product, The finished product
installing, OpenCV
intruder detector, The spec: turn your computer into an intruder detector
operating systems
commands to open a URL, Opening a web page in a browser
controlling programs with signals, The death of a process
different sizes of data types on, Use casting to put floats into whole numbers, Use casting to put floats into whole numbers
GUI libraries for, #9. Creating GUIs
interview with, Let’s update the code to use fprintf()
kernel, Security’s not the only problem
listing processes running on system, The exec() functions give you more control
makefiles and, Tell make about your code with a makefile
network configuration commands, Most system calls go wrong in the same way
OpenCV, OpenCV
registering new item in file descriptor table, fileno() tells you the descriptor
Standard Input and Standard Output, You can use redirection
system calls, System calls are your hotline to the OS
telnet program, The Internet knock-knock server
operators, #1. Operators
functions versus, What the computer thinks when it runs your code
precedence of, You need a pointer to the struct, (*t).age vs. *t.age
optarg variable, Let the library do the work for you, Let the library do the work for you
optimization, #6. More on gcc
optind variable, Let the library do the work for you
OR operator (|), ! flips the value of a condition, Bit twiddling
OR operator (||), There’s more to booleans than equals..., ! flips the value of a condition

P

parameters, function, But what does a complete C program look like?, ...and continue to continue
passing by value, The code is cloning the turtle
parent process, exec() is the end of the line for your program, Opening a web page in a browser
piped command on command line, Connect your processes with pipes
server, You can fork() a process for each client
partial compiles, First, compile the source into object files
PATH variable, The array functions: execv(), execvp(), execve()
including when passing environment variables on Cygwin, Passing environment variables
performance, analyzing with gprof, #8. Development tools
PIDs (Process Identifiers), The exec() functions give you more control
pid_status parameter of waitpid( ) function, The waitpid() function
pid_t in call to fork( ), 2. If you’re the child process, call exec()
waitpid( ) function parameters, The waitpid() function
pipe( ) function, Opening a web page in a browser
connecting Standard Output of child and Standard Input of parent processes, Case study: opening stories in a browser
pipes
connecting input and output, Connect your input and output with a pipe
connecting output of rssgossip.py to input of program, Case study: opening stories in a browser
connecting processes with, Connect your processes with pipes
important points about, Opening a web page in a browser
pointer arithmetic
and array index starting at 0, Why arrays really start at 0
and data types of pointer variables, Why arrays really start at 0
important points about, Why pointers have types
pointer notation with structs, (*t).age vs. *t.age
pointers, C code includes pointers
address of variable in memory, Digging into memory
and structs assigned to another variable, Read a struct’s fields with the “.” operator
array of arrays versus array of pointers, It’s time for a code review
array variables as, Array variables are like pointers...
C toolbox, Your C Toolbox
char pointers versus char arrays in data structure, Let’s fix the code using the strdup() function
conversion to ordinary number, What the computer thinks when it runs your code
differences of array variables from, But array variables aren’t quite pointers
file, fileno() tells you the descriptor
function, Every function name is a pointer to the function..., How to create function pointers, Advanced functions
arrays of, Create an array of function pointers
creating, ...but there’s no function data type
summary of important points, But how does an array help?
using to set sort order, Use function pointers to set the order
in recursive structures, Create a recursive structure
making it easier for functions to share memory, Try passing a pointer to the variable
passing pointer to variable as function parameter, Try passing a pointer to the variable
questions and answers about, Using memory pointers
set to string literals, avoiding, If you’re going to change a string, make a copy
sizes on different computers, What the computer thinks when it runs your code
summary of important points, Pointers and memory
to structs, You need a pointer to the struct
types assigned to pointer variables, Why arrays really start at 0
using for data entry, Using pointers for data entry
using to read and write data, Using memory pointers
variables declared as function arguments, If you’re going to change a string, make a copy
void, How do you create threads?
port number for server application, caution in choosing, A socket’s not your typical data stream
port, binding to, BLAB: how servers talk to the Internet
POSIX libraries, Let the library do the work for you
POSIX thread library (pthread), How do you create threads?
linking, Create threads with pthread_create
precompilation, Creating your first header file
preprocessing, Creating your first header file
fixing the source, Compilation behind the scenes
preprocessor directives, #2. Preprocessor directives
printf( ) function, But what does a complete C program look like?
reading from keyboard and writing to display, You can use redirection
variable number of arguments, Make your functions streeeeeetchy
printing to data stream with fprintf( ) function, fprintf() prints to a data stream
private scope, #3. The static keyword
Process Identifiers (see PIDs)
processes, Interprocess Communication: It’s good to talk
(see also interprocess communication)
cloning with fork( ) function, exec() is the end of the line for your program
communication, summary of important points, Processes and communication
control by kernel, Security’s not the only problem
examining a typical process, A look inside a typical process
redirecting themselves, Redirection just replaces data streams
replacement of current process using exec( ) functions, The exec() functions give you more control
running child process with fork( ) + exec( ), Running a child process with fork() + exec()
server and client, creating processes for clients with fork( ), You can fork() a process for each client
simple, doing one thing at a time, Simple processes do one thing at a time
speed of, threads versus, Use a mutex as a traffic signal
using for simultaneous tasks, limitations of, ...and processes are not always the answer
profiling tools, #8. Development tools
programs
compiling and running, But how do you run the program?
complete C program, But what does a complete C program look like?
exercise, matching candidate block of code with possible output, ...and continue to continue, ...and continue to continue
protocols, Knock-knock server overview, Writing a web client
ps -ef command, The exec() functions give you more control
pthread (POSIX thread) library, How do you create threads?
linking, Create threads with pthread_create
pthread_create( ) function, Create threads with pthread_create
pthread_join( ) function, Create threads with pthread_create
PTHREAD_MUTEX_INITIALIZER macro, Use a mutex as a traffic signal
pthread_mutex_lock( ) function, Use a mutex as a traffic signal
pthread_mutex_unlock( ) function, Use a mutex as a traffic signal
Python
installing, Read the news with RSS
RSS Gossip script, Read the news with RSS

R

raise( ) command, sending signals with, Use kill to send signals
recursive structures, Free the memory when you’re done, Data structures
creating, Create a recursive structure
recv( ) function, Reading from the client, getaddrinfo() gets addresses for domains
redirection, You can use redirection
child process output to file, dup2() duplicates data streams
descriptor table and, The waitpid() function
displaying error messages when output is redirected, But there’s a problem with some of the data...
output from display to files, But you’re not using files...
processes redirecting themselves, Redirection just replaces data streams
programs run from command line, Redirecting input and output
replacement of data streams, Redirection just replaces data streams
several processes connected with pipes, The bermuda tool
Standard Input, using < operator, You can redirect the Standard Input with <...
Standard Output, using > operator, ...and redirect the Standard Output with >
reference operator (&), Digging into memory, Using memory pointers
references, pointers versus, Using memory pointers
reserved words in C, Creating your first header file
return statements in functions, ...and continue to continue, ...and continue to continue
return type, But what does a complete C program look like?
compiler assumptions for unknown functions, Compilers don’t like surprises
void return type for thread functions, How do you create threads?
return values, assignments, ...and continue to continue
reusing code, If you have common features...
RSS feeds
program saving output of rssgossip.py script to file, dup2() duplicates data streams
program searching many feeds at once (example), Read the news with RSS
running rssgossip.py in separate process for each feed, 2. If you’re the child process, call exec()
reading news with, Read the news with RSS
reading story links from rssgossip.py script, Stay in touch with your child
running rsscossip.py script and opening stories in browser, Case study: opening stories in a browser
RSS Gossip (Python script), Read the news with RSS
running programs, But how do you run the program?

S

/sbin/ifconfig program, Most system calls go wrong in the same way
ifconfig program, Most system calls go wrong in the same way
scanf( ) function, Using pointers for data entry, If you’re going to change a string, make a copy
causing buffer overflows, Be careful with scanf()
fgets( ) function as alternative to, fgets() is an alternative to scanf()
passing pointer to variable to scanf( ), You need a pointer to the struct
using for data input, fgets( ) versus, Using sizeof with fgets()
screen, redirecting data to, without using Standard Output, The waitpid() function
security, system calls and, Then someone busted into the system...
send( ) function, A socket’s not your typical data stream, getaddrinfo() gets addresses for domains
sentinel character , The program works!
serial port, writing to (C code in Arduino), Here’s what your code should do
setitimer( ) function, ...the timer fires a SIGALRM signal
sharing code, If you have common features..., Angle brackets are for standard headers
.h header files, Sharing .h header files
short type, Using Multiple Source Files: Break it down, build it up, Using Multiple Source Files: Break it down, build it up
defined, Using Multiple Source Files: Break it down, build it up
SHRT_MIN macro, #4. How big stuff is
shunit2 tool, testing scripts and commands, #5. Automated testing
sigaction structs, Catching signals and running your own code
sigaction( ) function, sigactions are registered with sigaction()
SIGALRM signal, Sending your code a wake-up call
SIGKILL signal, Use kill to send signals
signals, The death of a process
catching and running your own code, Catching signals and running your own code
ignoring, ...the timer fires a SIGALRM signal
matching to cause (example), Rewriting the code to use a signal handler
order of sending and receiving, ...the timer fires a SIGALRM signal
program testing math skills (example), ...the timer fires a SIGALRM signal
resetting to default handler, ...the timer fires a SIGALRM signal
sending using kill command, Use kill to send signals
sending using raise( ), Use kill to send signals
signed values in binary, Don’t put something big into something small
SIGTERM signal, Use kill to send signals
single statement, Two types of command
size limits for data types, macros determining, #4. How big stuff is
sizeof operator, How do you pass a string to a function?, What the computer thinks when it runs your code
getting bytes in memory occupied by particular data type, Ask for memory with malloc()...
use on pointers and array variables, But array variables aren’t quite pointers
using with fgets( ) function, fgets() is an alternative to scanf()
sleep( ) function, Create threads with pthread_create
alarm( ) function and, Sending your code a wake-up call
small tools
connecting input and output with a pipe, Connect your input and output with a pipe
converting data from one format to another, Small tools can solve big problems
designing, tips for, Don’t change the geo2json tool
different tasks need different tools, A different task needs a different tool
flexibility of, Small tools are flexible
output to multiple files, But what if you want to output to more than one file?
sockets and networking, Sockets and Networking: There’s no place like 127.0.0.1
C toolbox, Your C Toolbox
client sockets, creating socket for a domain name, getaddrinfo() gets addresses for domains
client sockets, creation and connection to remote port, Create a socket for an IP address
clients obtaining a socket and communicating, Clients are in charge
creation of sockets with IP addresses or domain names, Create a socket for a domain name
fork( ) a process for each client, You can fork() a process for each client
how servers talk to the Internet, BLAB: how servers talk to the Internet
Internet knock-knock server (example), The Internet knock-knock server
other useful server functions, Reading from the client
reading from the client, Reading from the client
server can only talk to one client at a time, The server can only talk to one person at a time
server code changed to fork child process for each client, The parent and child use different sockets
server generating random advice for clients (example), A socket’s not your typical data stream
sockets not your typical data streams, A socket’s not your typical data stream
summary of important points, Sockets and networking
writing a web client, Writing a web client, Create a socket for a domain name
writing code for Internet knock-knock server (example), Reading from the client
sorting, Get it sorted with the C Standard Library
using function pointers to set sort order, Use function pointers to set the order
writing comparator functions for different sorts, Use function pointers to set the order
source files, C is a language for small, fast programs
compiling and running, But how do you run the program?
multiple files for code, Multiple files
spaceship (Blasteroids game), The spaceship
behavior of, Spaceship behavior
stack, Digging into memory
defined, Memory memorizer
differences from the heap, Free the memory when you’re done
storage in, Use the heap for dynamic storage
Standard Error, Introducing the Standard Error, Data streams
default output to display, By default, the Standard Error is sent to the display
in descriptor table, Redirection just replaces data streams
redirecting with 2>, fprintf() prints to a data stream, Redirection just replaces data streams
standard header directories, Angle brackets are for standard headers
standard header files, Creating your first header file
Standard Input, fprintf() prints to a data stream, Data streams
connecting to Standard Output of another process, Connect your input and output with a pipe
in descriptor table, Redirection just replaces data streams
redirecting, You can use redirection
redirecting with < operator, You can redirect the Standard Input with <...
Standard Output, Data streams
connecting to Standard Input of another process, Connect your input and output with a pipe
in descriptor table, Redirection just replaces data streams
redirecting child process output to file, dup2() duplicates data streams
redirecting to file, ...and redirect the Standard Output with >, Redirecting input and output
standards, C is a language for small, fast programs
compiler support of, But what does a complete C program look like?
designated initializers, How do you use a union?
POSIX libraries, Let the library do the work for you
return statements in functions, ...and continue to continue
statements, Two types of command
static keyword, #3. The static keyword
static libraries, Static and Dynamic Libraries: Hot-swappable code, Static and dynamic libraries
stdarg.h header, So how can YOU do that?
storage, flexible, Do you need flexible storage?
strcmp( ) function, Use function pointers to set the order, Use function pointers to set the order
strdup( ) function, Oh, no! It’s the out-of-work actors...
calling malloc( ) function, Free the memory when you’re done
fixing create( ) function that uses dynamic allocation, Let’s fix the code using the strdup() function
strerror( ) function, Most system calls go wrong in the same way
string literals, The program works!
char pointer set to, avoiding, If you’re going to change a string, make a copy
important points about, If you’re going to change a string, make a copy
inability to update, Oops...there’s a memory problem...
string.h header file, Find strings containing the search text
more information about functions in, It’s time for a code review
strings, The program works!, Strings: String theory
array of arrays versus array of pointers, It’s time for a code review
arrays of, char** pointer to, How to create function pointers
as character arrays, The program works!
BE the Compiler exercise, jukebox program (example), Using the strstr() function
C toolbox, Your C Toolbox
changing, using copy for, If you’re going to change a string, make a copy
code shuffling letters in, Anyone for three-card monte?
copying, Oh, no! It’s the out-of-work actors...
creating array of arrays, Create an array of arrays
crossword puzzle (example), Array of arrays vs. array of pointers
displaying string backward on screen, It’s time for a code review
ending with sentinel character , The program works!
passing to functions, How do you pass a string to a function?
searching, Desperately seeking Susan Frank, Find strings containing the search text
Pool Puzzle example, Using the strstr() function
review of jukebox program (example), It’s time for a code review
testing jukebox program (example), It’s time for a code review
Standard Library, string.h, Find strings containing the search text
summary of important points, Strings
using strstr( ) function, Using the strstr() function
strstr( ) function, Using the strstr() function
structs, Structs, Unions, and Bitfields: Roll your own structures, An enum variable stores a symbol, Inserting values into the list
arrays versus, Create your own structured data types with a struct, Read a struct’s fields with the “.” operator
assignment, The code is cloning the turtle
benefits of using, Just give them the fish
bitfields collected in, Bitfields store a custom number of bits
creating aliases for with typedef, Can you put one struct inside another?
designated initializers setting initial value of fields, Set the value with dot notation
enums tracking values stored in, An enum variable stores a symbol
holding sequence of single bits for yes/no values, Sometimes you want control at the bit level
in memory, Read a struct’s fields with the “.” operator
nesting, Can you put one struct inside another?
pointer notation, (*t).age vs. *t.age
pointers to, You need a pointer to the struct
reading fields with . (dot) operator, Read a struct’s fields with the “.” operator
recursive structures, Create a recursive structure, Free the memory when you’re done
summary of important points, Structs
updating, How do you update a struct?
using bitfields in customer satisfaction survey (example), Bitfields store a custom number of bits
using with unions, Set the value with dot notation
values separated with semicolon (;), An enum variable stores a symbol
wrapping parameters in, Just give them the fish
structured data types (see structs)
switch statements, Pulling the ol’ switcheroo
rewriting code to replace sequence of if statements, Pulling the ol’ switcheroo
summary of important points about, Pulling the ol’ switcheroo
symbols, storing in enums, An enum variable stores a symbol
system calls, System calls are your hotline to the OS, Your C Toolbox
accept( ) function, 2. Listen
avoiding writing duplicate code for error handling, dup2() duplicates data streams
checking for errors on, A socket’s not your typical data stream
exec( ) functions, The exec() functions give you more control
failures of, Most system calls go wrong in the same way
order-generation program, Starbuzz coffee (example), Most system calls go wrong in the same way
program searching many RSS feeds at once (example), Read the news with RSS
fork( ) function, cloning processes with, exec() is the end of the line for your program
getenv( ) function, reading environment variables, Passing environment variables
important points about, Most system calls go wrong in the same way
listen( ) function, 2. Listen
mkfifo( ) function, Opening a web page in a browser
running child process with fork( ) and exec( ), Running a child process with fork() + exec()
security breaches, Then someone busted into the system...
system( ) function, System calls are your hotline to the OS, 2. If you’re the child process, call exec(), Your C Toolbox
exec( ) function versus, Most system calls go wrong in the same way
opening a web page in a browser, Opening a web page in a browser

T

tab character, beginning recipe lines for makefiles, Tell make about your code with a makefile, Tell make about your code with a makefile
target files, Automate your builds with the make tool
describing in makefiles, Tell make about your code with a makefile
taskmgr command (Windows), The exec() functions give you more control
tasks, sequential or parallel, Tasks are sequential...or not...
telnet program, The Internet knock-knock server
ternary operator (?:), #1. Operators
testing, automated, #5. Automated testing
threads, Threads: It’s a parallel world
C toolbox, Your C Toolbox
creating, How do you create threads?
using pthread_create( ), Create threads with pthread_create
deciding where to put locks in code (example), Use a mutex as a traffic signal
important points about, Use a mutex as a traffic signal
multithreaded programs, Employ extra staff: use threads
mutexes, You need to add traffic signals
passing long values to thread functions, Use a mutex as a traffic signal
program counting down beers (example), Create threads with pthread_create
single threads of execution, Simple processes do one thing at a time
summary of important points, Advance Praise for Head First C
thread safety in code, The code is not thread-safe
using mutex to control execution, Use a mutex as a traffic signal
timers for processes, ...the timer fires a SIGALRM signal
transformations, Use transformations to move things around
true and false values, ! flips the value of a condition
typedef command
creasting aliases for structs, Can you put one struct inside another?
recursive structures and, Create a recursive structure

U

unions, Sometimes the same type of thing needs different types of data, An enum variable stores a symbol, Unions and bitfields
enums tracking values stored in, An enum variable stores a symbol
important points about, Bitfields store a custom number of bits
reuse of memory space, A union lets you reuse memory space
setting value of, How do you use a union?
using with structs, Set the value with dot notation
values separated with semicolon (;), An enum variable stores a symbol
values stored in, data types of, unions are often used with structs
unistd.h header, Let the library do the work for you
unsigned keyword, prefixing data types with, Use casting to put floats into whole numbers
URLs, opening on various operating systems in web browser, Opening a web page in a browser

V

valgrind tool, using to find memory leaks, Software forensics: using valgrind
values
copied when assigning structs, The code is cloning the turtle
matching data type to type of variable it’s stored in, Don’t put something big into something small
parameters passed to functions, The code is cloning the turtle
storing short-range values in bitfields, Bitfields store a custom number of bits
variables
matching data type for value stored in, Don’t put something big into something small
sharing among code files, The shared code needs its own header file
storage in memory, Digging into memory
using to shorten makefiles, #7. More on make
variadic functions, Make your functions streeeeeetchy
writing example function, So how can YOU do that?
virtual memory size, Security’s not the only problem
void functions, ...and continue to continue, ...and continue to continue
void pointers, Use function pointers to set the order, How do you create threads?

W

waitpid( ) function, Sometimes you need to wait...
important points about, The waitpid() function
parameters, The waitpid() function
warnings, gcc, Warnings
web browsers, opening a web page in, Opening a web page in a browser
websites for C, #10. Reference material
WEXITSTATUS( ) macro, The waitpid() function
while loops, Sometimes once is not enough...
modifying in card counting program to keep running count, ...and continue to continue, ...and continue to continue
structure of, Loops often follow the same structure...
summary of important points, ...and continue to continue
window, creating in OpenCV, Detect an intruder
Windows systems, Opening a web page in a browser
(see also operating systems)
.exe files, But how do you run the program?
CreateProcess( ) function instead of fork( ), 2. If you’re the child process, call exec()
fork( ) function and, exec() is the end of the line for your program, 2. If you’re the child process, call exec()
GUI libraries, #9. Creating GUIs
ipconfig command, Most system calls go wrong in the same way
listing processes running on system, The exec() functions give you more control
make tools, How make works
telnet program, built-in versus Cygwin versions, The Internet knock-knock server

X

XOR encryption, If you have common features...
XOR operator, bitwise XOR (^), Bit twiddling
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset