+ Reply to Thread
Page 1 of 2
1 2 Last
Results 1 to 15 of 18

Thread: C programming help

  1. #1
    Kurupt Newbie
    Join Date
    Oct 2003
    Location
    Calgary, Alberta
    Posts
    15

    Default C programming help

    I was wondering if anyone knew of any good C programming books to learn from.

    I'm an engineering student and am taking an introductory course on C programming. The instructor told us to get C How to Program Fourth Edition by Deitel and Deitel. The book isn't too great on explaining the concepts and I was wondering if anyone knew of some good books to learn from.

    The course covers the simple stuff like if/else, do/while etc., as well as functions, arrays, pointers and classes. If anyone knows of some good books or websites that explain these concepts well could you let me know.

    Thanks.


  2. #2
    crust Okay
    Join Date
    Sep 2003
    Posts
    728

    Default

    I like the book "data structures and algorithms in C" ... it is not as much a tutorial, but provides very good descriptions of algorithms and methods that you are likely to use as an engineer?

    As an aside, here is a tip/trick --

    Which is preferred, statement A or B and why?

    A: if (x == 11) { ... }
    B: if (11 == x) { ... }

  3. #3
    Well Cookin Newbie
    Join Date
    Oct 2003
    Location
    Baldock, Herts, UK
    Posts
    10

    Default

    'The C Programming Language' by Brian W. Kernighan and Dennis M. Ritchie is the C programmers bible. Known in the trade as the 'Kernighan and Ritchie' or 'K&C' book - many swear by it. It is concise and makes an excellent reference book. Yes you can get books full of tips and tricks and these are good too. But I feel that modern programming language books are too wordy - they take several pages to teach you something that K&C does in a one. It's a matter of personal need and taste I guess.

  4. #4
    Agent 009 Newbie
    Join Date
    May 2003
    Location
    Lebanon
    Posts
    523

    Default Deitel's publications

    I don't know why you thought Deitel's book isn't so great. Because I ran into a lot of Deitel's publications, C++ included, and they were just great: you could study a course on programming just self-paced! No need for anyone to explained more! Anyway, you don't like it, you don't like it.. If you ever need help in a program or something, just tell me. I'm also an engineering student...

  5. #5
    StupidDum Newbie
    Join Date
    Nov 2003
    Location
    Malaysia
    Posts
    242

    Default

    I first learned C in an "IT" way, meaning, declare as many variable as i like, dont bother about byte,long, double... since we have unlimited RAM, and high speed in our PC.
    However, after i started programming C for PIC, then i realised the difference of C between engineering and IT. I have to consider carefully before using any BIT of RAM, and write efficient code to reduce the program memory needed...etc

  6. #6
    Well Cookin Newbie
    Join Date
    Oct 2003
    Location
    Baldock, Herts, UK
    Posts
    10

    Default

    Very true indeed StupidDum.

    There is a world of difference between programming for a resource-rich environment such as a PC and the limited resources of the embedded system. Many considerations need to be included at the design stage such as memory size and its physical location, computational costs, interrupt timing, bus bandwidths, hardware delays and so on... Most (if not all) of these can be conveniently ignored when writing for a PC - which is probably why most PC software is really 'bloatware'. That's not to say that PC software (e.g. Windows) is bad (although sometimes it feels that way!). If resources are abundant then, apart from the obvious gains of being able to add more functionality, you can consider using better programming methodologies (such as OO) and making the software more flexible, maintainable and more platform independent.

    There's always a trade-off between efficiency and flexibility.

    Yer pays yer money, an' yer makes yer choice...

  7. #7
    Sherif Welsen Newbie
    Join Date
    Aug 2003
    Location
    Cairo, Egypt
    Posts
    105

    Default

    Try this book:
    C Programming using Turbo C++, by Robert Lafore.
    Its really good book.
    I walked on the rout of 1000-mile...
    when I arrived, I found out I’ve ‎‎walked in the wrong way.

  8. #8
    fat-tony Newbie
    Join Date
    Nov 2003
    Location
    Saskatoon, SK, Canada
    Posts
    143

    Default

    In my intro course, we're using C++ For Scientists and Engineers (I think that's what it's called). We haven't actually used any of the C++ structures like vectors, stacks, etc..., and it has been 99% C compatible code. It's been a pretty good little refresher (I used to program in C, and then kinda fell out of habit).

    Our class website is at http://www.cs.usask.ca/classes/index...116&section=T1 if you're interested.

  9. #9
    eemage21 Newbie
    Join Date
    Nov 2003
    Posts
    35

    Default

    "SAM's Teach yourself C in 21 Days" - hands down the best book out there. I love their books.
    That one covers everything you need to know, and explains it really easy.
    \"There are only 10 types of people in the world: those who understand binary, and those who don\'t...\"

  10. #10
    Agent 009 Newbie
    Join Date
    May 2003
    Location
    Lebanon
    Posts
    523

    Default

    Yeah, the SAM's editions are great for fast learning. I had the C++ in 21 days. But maybe you should consider the Deitel's book.. I think they're the best...

  11. #11
    petesmc Newbie
    Join Date
    Nov 2003
    Posts
    60

    Default

    B: if (11 == x) { ... } is the preferred statement, because it's faster for a compiler to compile as it is in a better format for reverse polish notation (RPN).

    Just a guess...

  12. #12
    Agent 009 Newbie
    Join Date
    May 2003
    Location
    Lebanon
    Posts
    523

    Default

    What's a RPN??

  13. #13
    crust Okay
    Join Date
    Sep 2003
    Posts
    728

    Default

    Quote Originally Posted by petesmc
    B: if (11 == x) { ... } is the preferred statement, because it's faster for a compiler to compile as it is in a better format for reverse polish notation (RPN)
    Sorry to hijack the thread ... thats a good guess, but not correct. RPN is reverse polish notation (as petesmc mentioned). I'll give this a few more days and I'll post the reason why.

  14. #14
    riteet Newbie
    Join Date
    Jul 2003
    Location
    Rochester, NY
    Posts
    9

    Default which is better?

    Crust,

    Would a bigger part have to deal with the design of the compiler being used?

    Paradigm's tool gave me the exact same assembly for each of the mentioned code snippets:

    ; if (x == 11)
    ;
    ?debug L 9
    cmp word ptr [bp-2],11
    jne short @1@3

    ; if (11 == x)
    ;
    ?debug L 14
    cmp word ptr [bp-2],11
    jne short @1@5

    since I can't see the difference in the assembly, I'll either say that it would depend on the compiler. But could it be that one syntax over the other might make it easier/quicker for the parser? That's all I got now I'm frustrated :!:

  15. #15
    crust Okay
    Join Date
    Sep 2003
    Posts
    728

    Default Re: which is better?

    Quote Originally Posted by riteet
    But could it be that one syntax over the other might make it easier/quicker for the parser?
    That is a very close guess as to why one is better than the other. In fact, the assembly should not be any different b/c the statement is fairly simple and the comparison is commutative.

+ Reply to Thread
Page 1 of 2
1 2 Last

Tags for this Thread