Re: Please Help ----------Free Downloadable Ebooks for C & C++ Language needed



Richard Heathfield wrote:
jacob navia said:


Richard Heathfield wrote:

jacob navia said:

<snip>

Download the tutorial.pdf.


Have you yet fixed the bugs in that tutorial that were pointed out last
time you pushed it?


Yes, I hope so.


Upthread, you said:

"Download the tutorial.pdf. It has a complete description of C"

The tutorial says:

"this is not a full-fledged introduction to all of C." and "there isn't here a description of all the features of the language".

I spot a contradiction, don't you?

It could be a contradiction, but actually after writing that sentence (when I started the tutorial project) I went on to a complete description of every feature. This started with the big tables where I describe ALL operators, syntax quircks, preprocessor stuff, etc.

A fair description would be a "almost complete description"

Anyway, here are the next half-dozen bugs for you. But you might find it easier to find someone who knows C, and get them to go through the whole thing, fixing all the bugs in one fell swoop.


Minor nit: on page 16, strictly speaking the argument to your printf call is the result of evaluating "Hello\n" - and that result is a pointer, not a string.


It is a pointer to a string. OK.

Medium nit: merely saying that the return value from main is optional is to miss an opportunity to explain why main returns a value, and what that value is used for.


True, I will add that.

Medium nit: For int fn(int a) on page 18, you claim that a is an argument. It isn't. It's a parameter. You continually confuse the two in your tutorial.


Parameter is from the function's point of view, argument is from the calling function's point of view... Is that very important?


Major nit: you claim on page 19 that, when you see a statement like printf("Hello\n"); the address of the first element is passed to printf (which is true), but you then say that "the array can be modified by the function you are calling". But the printf function takes const char * as its first parameter. It cannot modify the array whose first element's address is passed, except by violent means, such as casting away the constness.


Yes in the case of printf you are right. I will use another example.


Medium nit: compilers exist which pre-date C99 and for which their implementors, at the time of release, correctly claimed conformance to ANSI C. On page 22, you give a list of headers which *all* "ANSI compliant" C compilers provide. So a reader, learning C from your tutorial but using an early Borland or Microsoft compiler, is going to be very confused by your list. They will also be thrown by your occasional for(int i = ...) code.


Here we disagree. I mean as ANSI compliant compilers that conform to the
current ANSI standard for the C language: C99.

Major nit: On page 24, "char *argv[] This is an array..." It isn't. It's a pointer.


It is a pointer to an array of pointers.

Normally the arguments are accessed using array notation (argv[2]). But eternal confusion in C between pointers and arrays will be difficult
to explain. See our other discussion yesterday about array/pointers
.



Relevant Pages

  • Re: char **argv & char *argv[]
    ... "pointer to pointer to char". ... >> pointer)) pointing to the first element of an array. ... so we have to start adding more context. ... type "pointer to char", rather than "array MISSING_SIZE of char". ...
    (comp.lang.c)
  • Re: Why do so few people know the difference between arrays and pointers.
    ... > That's the difference between C usage and English usage. ... > distinguish between a pointer to an area of memory containing a single ... or an area containing an array of integers. ... What create bugs ...
    (comp.lang.c)
  • Re: multi dimensional arrays as one dimension array
    ... please - where does the standard say that such a conversion ... Pointer conversion yields a pointer to the same object as ... exist only where there are array declarations. ...
    (comp.lang.c)
  • Re: Evaluating unary *
    ... 'arr' exists, ... value can be used with the same syntax as would be used to access a 2D array of the kind you're referring to, but that 2D array is just a different way of looking as the same object that was already created by the definition of 'arr'. ... to me, it makes sense to return a pointer to the first value of an array, but to return the address of the pointer to the first value of an array, is not directly possible as such. ... lea eax, ...
    (comp.std.c)
  • Re: "Mastering C Pointers"....
    ... A pointer is a kind of variable that can "point to" some object. ... has a type (pointer to int), and a value of some kind. ... You may know that you can access these integers by using array notation ... The function will take one argument, a string, and will return the length ...
    (comp.lang.c)