I was wondering about what would be a good book(s) for learning to write code? I know nopthing about it but would like to learn.
Steve
what are good books for learning to program C/C++
Moderator: Ras
-
- Posts: 62
- Joined: Thu Apr 03, 2008 8:54 pm
-
- Posts: 922
- Joined: Sun Nov 19, 2006 9:16 pm
- Location: Russia
- Full name: Aleks Peshkov
Re: what are good books for learning to program C/C++
Bjarne Stroustrup's book is much more then language introduction from the its creator, but a guide of the good modern programming style.
But you need to know about general computer architecture and programming basics (variables, memory pointers, loops) before reading this book.
But you need to know about general computer architecture and programming basics (variables, memory pointers, loops) before reading this book.
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: what are good books for learning to program C/C++
If you know nothing about coding perhaps C comes easier if you know a bit of how a processor works, instead, if you don't have clues about how hardware works perhaps start with Java that is more clean and correctly laid out (we can say modern) then Chawkeye wrote:I was wondering about what would be a good book(s) for learning to write code? I know nopthing about it but would like to learn.
-
- Posts: 613
- Joined: Sun Jan 18, 2009 7:03 am
Re: what are good books for learning to program C/C++
Hard to say where one should start with... I learned the basics by borrowing books from library. At least here in Finland in almost every public library there is a lot of books dealing with C++ or Java programming.
Joona Kiiski
-
- Posts: 6401
- Joined: Thu Mar 09, 2006 8:30 pm
- Location: Chicago, Illinois, USA
Re: what are good books for learning to program C/C++
You can learn C even if you know nothing about how a processor works. You learn along if needed. For a complete beginner I may suggest Ruby or Python as valid alternatives. There is something very natural about these two languages. I learned with Pascal (I fooled around with BASIC, but I really *learn* programing with Pascal). Not a bad option.mcostalba wrote:If you know nothing about coding perhaps C comes easier if you know a bit of how a processor works, instead, if you don't have clues about how hardware works perhaps start with Java that is more clean and correctly laid out (we can say modern) then Chawkeye wrote:I was wondering about what would be a good book(s) for learning to write code? I know nopthing about it but would like to learn.
Miguel
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: what are good books for learning to program C/C++
And please explain me how you justify you have stuff like integer, unsigned integer, long, long long, char, unsigned char, etc... just to say "an integer number".michiguel wrote:You can learn C even if you know nothing about how a processor works.
And this is just a very silly example, but the list of stuff that exsists just because of how things are represented in hardware is very long in C, and _has_ to be like this given the reason why C was invented for.
-
- Posts: 1260
- Joined: Sat Dec 13, 2008 7:00 pm
Re: what are good books for learning to program C/C++
I don't think you need to "justify" anything to learn the language.mcostalba wrote: And please explain me how you justify you have stuff like integer, unsigned integer, long, long long, char, unsigned char, etc... just to say "an integer number".
And this is just a very silly example, but the list of stuff that exsists just because of how things are represented in hardware is very long in C, and _has_ to be like this given the reason why C was invented for.
-
- Posts: 6401
- Joined: Thu Mar 09, 2006 8:30 pm
- Location: Chicago, Illinois, USA
Re: what are good books for learning to program C/C++
If you read K&R II book, you learn whatever is needed to get you going. It is not that complicated.mcostalba wrote:And please explain me how you justify you have stuff like integer, unsigned integer, long, long long, char, unsigned char, etc... just to say "an integer number".michiguel wrote:You can learn C even if you know nothing about how a processor works.
And this is just a very silly example, but the list of stuff that exsists just because of how things are represented in hardware is very long in C, and _has_ to be like this given the reason why C was invented for.
Miguel
-
- Posts: 2684
- Joined: Sat Jun 14, 2008 9:17 pm
Re: what are good books for learning to program C/C++
I have read it many years ago, thank youmichiguel wrote:If you read K&R II book, you learn whatever is needed to get you going. It is not that complicated.mcostalba wrote:And please explain me how you justify you have stuff like integer, unsigned integer, long, long long, char, unsigned char, etc... just to say "an integer number".michiguel wrote:You can learn C even if you know nothing about how a processor works.
And this is just a very silly example, but the list of stuff that exsists just because of how things are represented in hardware is very long in C, and _has_ to be like this given the reason why C was invented for.
Miguel

But "not complicated" doesn't mean elegant or logical or well designed from a learning point of view. C was not borne to be a language from where to learn how to program (Pascal was), but not because it is complicated, but because has a lot of tricks and low level design compromises so to be powerful and useful mainly by system programmers in the real world, not in a laboratory.
Regarding Python et similars, they are interesting of course, but far from the chess engine applications, if this is his intended ultimate target it would be better to start with something well designed and so with a good attitude toward being a learning tool but not too far away from what is commonly used to build up a chess engine.
-
- Posts: 750
- Joined: Mon Mar 27, 2006 7:45 pm
- Location: Finland
Re: what are good books for learning to program C/C++
C is a small language, and thus easy to learn. "The C Programming Language" by K&R is very good.
C++ is a huge language, and many things seem unintuitive at first. That's why I'd recommend a book like "Thinking in C++" which teaches good programming practices and helps the reader to understand the weird design of some of the language features.
C++ is a huge language, and many things seem unintuitive at first. That's why I'd recommend a book like "Thinking in C++" which teaches good programming practices and helps the reader to understand the weird design of some of the language features.