Thread: question about c books

  1. #1
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54

    question about c books

    Question: which one of these two books is supposed to be read first if one wants to learn how to program in c
    -c, a modern approach
    (or)-let us c.
    or can you just pick one one of them and ignore the other one, since they are both books for beginners?
    Thx in advance.

  2. #2
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    Still the same question again and again and again ...

    Bye, Andreas

  3. #3
    Registered User
    Join Date
    Dec 2011
    Location
    Eindhoven, Noord-Brabant, Netherlands
    Posts
    54
    Quote Originally Posted by AndiPersti View Post
    Still the same question again and again and again ...

    Bye, Andreas
    dude, i keep getting sick and ending up @ the hospital with emergency and spending days there, that's y i'm always askin. I just couldn't learn all those times i've asked, because i was either getting the wrong medicine or simply kinda sick. Since I managed to get my hands on these books, i'm askin this simple question. It's just a simple question, i've never asked about these 2 books.
    Last edited by Kuro Tensai; 04-09-2013 at 05:30 AM.

  4. #4
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    c, a modern approach
    Crap.

    let us c
    Crappier.

  5. #5
    young grasshopper jwroblewski44's Avatar
    Join Date
    May 2012
    Location
    Where the sidewalk ends
    Posts
    294
    Stop asking, start reading.

    Also, go here: C Book Recommendations

  6. #6
    spaghetticode
    Guest
    Quote Originally Posted by Kuro Tensai View Post
    dude, i keep getting sick and ending up @ the hospital with emergency and spending days there, that's y i'm always askin. I just couldn't learn all those times i've asked, because i was either getting the wrong medicine or simply kinda sick.
    The recommendations you got so far in your hundreds of other questions don't have a "best before" printed on them. You have been told everything you need to start working enough times.

  7. #7
    Registered User
    Join Date
    May 2012
    Posts
    1,066
    @Barney:
    Out of curiosity: What is bad about "C. A modern approach"?

    Bye, Andreas

  8. #8
    Stoned Witch Barney McGrew's Avatar
    Join Date
    Oct 2012
    Location
    astaylea
    Posts
    420
    It takes a lot of work to properly criticise an entire reference, but I'll list a few points from version #2 of the reference:

    scanf is used continuously without consideration for its return value. Many examples presented in that reference will cause undefined behaviour when given undesirable input, as uninitialised automatic objects are assumed to be assigned values by scanf. This bad habit is introduced in section 2.6 and used throughout the reference.


    To comment more on I/O-related errors, consider the code from section 7.3 (length.c):


    Code:
     #include <stdio.h>
    
    
    int main(void)
    {
    	int len = 0;
    
    
    	printf("Enter a message: ");
    	while (getchar() != '\n')
    		len++;
    	printf("Your message was %d character(s) long.\n", len);
    	return 0;
    }

    - With an interactive device, the desired effect of having "Enter a message: " pop up may not be achieved if stdout is line buffered. A call to fflush is necessary.
    - The return value of getchar is not checked for EOF or handled appropriately. That code could fall into an infinite loop.
    - Although it isn't all that significant and a fairly unlikely event, len can overflow. An unsigned type would have been a better choice.


    That scanf thing was the first thing I noticed. If I flip through at random and see what else I can find ...


    From section 10.5:
    Code:
    int i ;
    
    
    void f(int i)
    {
    	i = 1;
    }
    
    
    void g(void)
    {
    	int i = 2;
    	...
    ...
    - In Declaration 2, i is a parameter with block scope.
    - In Declaration 3, i is an automatic variable with block scope.
    ...

    - In Declaration 2 the identifier, i, has function prototype scope and the object associated with that identifier has automatic storage duration.
    - In Declaration 3 the identifier, i, has block scope and the object associated with that identifier has automatic storage duration.


    From section 12.1:
    Performing arithmetic on a pointer that doesn't point to an array element
    causes undefined behaviour. Furthermore, the effect of subtracting one pointer
    from another is undefined unless both point to elements of the same
    array.
    This isn't true since it's perfectly fine to point at the end of an array.


    In section 23.5 he passes chars to the ctype functions without a cast to unsigned char. Scary stuff!


    There are surely more mistakes in this book but I haven't really analysed it thoroughly. I looked at one of the versions of Let Us C and it seemed really horrible. I think it mixed C with all of this DOS stuff as well in the later chapters, so to me it seemed a lot worse than this one.


    My opinion is that all the C references I've seen are all horrible, but some are less horrible than others. I think K&R2 is the least horrible of the ones I've seen and its main benefits are that it uses very precise language and has a good set of exercises; it's good at teaching the basics of the C language and that's really it. If you want a book on computer programming you should probably look at SICP, for algorithms TAOCP, for the specifics of C the standard documents and c-faq.com, and for using C in practice TPOP. Then there are many other specialised subjects like writing compilers, using networks or graphics, using certain libraries, etc. that none of the references listed above really cover at all, so for a beginner who's learning programming and starting with C, there isn't really one reference that will give them all the information they need.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ books question
    By Kuro Tensai in forum C++ Programming
    Replies: 2
    Last Post: 02-10-2013, 07:46 AM
  2. Books (not specifically programming books)
    By DavidP in forum General Discussions
    Replies: 6
    Last Post: 11-05-2009, 07:33 PM
  3. question on C++ books
    By alyeska in forum C++ Programming
    Replies: 2
    Last Post: 12-10-2006, 02:24 AM
  4. Books Books Books
    By aresashura in forum Game Programming
    Replies: 5
    Last Post: 12-28-2001, 09:08 PM