Liste des Groupes | Revenir à cl c |
On 2024-07-12, Janis Papanagnou <janis_papanagnou+ng@hotmail.com>
wrote:On 12.07.2024 08:00, David Brown wrote:[...]>
I can understand when someone new to C gets mixed up about how
arrays work.
I can't understand that if I presume that the person has read any
basic textbook about "C".
Problem is that over the years there have been authors of basic
textbooks about "C" who were also confused by things like this.
For instance, in Herbert Schildt's "C: The Complete Reference",
3rd Ed, page 53, this can be found:
/* Write 6 integers to a disk file. */
void put_rec(int rec[6], FILE *fp)
{
int len;
len = fwrite(rec, sizeof rec, 1, fp);
if(len != 1) printf("write error");
}
Of course, "sizeof rec" is the size of a pointer, not likely
equal to the size of an array of 6 elements.
The intersection of authors who are skillful presenters of material,
knowledgeable about C, and motivated to write about it has not been
that large. We could add to that, "write about new C, and motivated
to keep up with ISO C developments and crank out new edititons".
Les messages affichés proviennent d'usenet.