Errata

C in a Nutshell

Errata for C in a Nutshell

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Printed Page 153
Last 3 paragraphs

The text (correctly) stresses that the name of an array is implicitly converted to a pointer to the array's first element. Thus, given the following two declarations

int a [10];
int (*arrPtr) [10] = NULL;

it is not possible to make arrPtr point to the array a through a simple assignment:

arrPtr = a; // (1) Error: mismatched pointer types.

However, while the proposed solution – a type-cast to (int (*) [10]) – works, I think it would be simpler (and much easier to understand) to just correct the mismatching pointer types:

arrPtr = &a; // (2) address of a is assignable to arrPtr

Keeping in mind that (*arrPtr)[i] is equivalent to *(*arrPtr + i), it would then be obvious why (*arrPtr)[i] ⇔ *(*&a + i) is syntactically correct, while *(*a + i) – the expression corresponding to case (1) – couldn't possibly be accepted by the compiler.

Michael Stumpfl  Nov 01, 2016 
Printed Page 187
United States

Under section "Closing a File".

Replace the word "greater" with "less" in the last sentence of the last paragraph, so that it reads:
'Furthermore, there is a limit to the number of files that a program may have open at one time; the number of allowed open files is less than or equal to the value of the constant FOPEN_MAX.'

Ammar James  Feb 16, 2014 
Printed Page 323
fgetws code example, line 6

The fwide() call is missing the mode parameter. It currently reads:

fwide( fp_in_wide );

It should read:

fwide( fp_in_wide, 1 );

Chris Coffey  May 08, 2017