![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jul 2006
Location: Pepperland
Posts: 16
Rep Power: 0
![]() |
I think I bought an outdated book on C
Today I went to Barnes and Noble and I have suspicions that I might have purchased a book on C that is outdated. Here's the classic "hello world" app. ex:
(I don't know what the code tags are for this site so I'm going to guess and change it if it's other than basic HTML tags) #include <stdio.h>
main()
{
printf("hello world");
return 0;
}Note the lack of int. Does it have to have the integer there or what? I get the feeling that it's not ANSI C.. although it does feature a return 0;. If it helps the book is The Absolute Beginners Guide to C and I picked it up because I heard it was an excellent resource from one of my friends whom is decent at C/C++. When I got home I found out the copywrite was 1994:mad: My question is if someone could take a look at the code and say "Hey, that isn't ANSI compliant" or "Hey, that is ANSI compliant - you didn't waste 20 bucks" it would most certainly be appreciated. Also, what if it is outdated? I'm only planning on screwing around with basic DOS apps and having fun at the moment anyway, I just want borland 5.5 to compile it without errors or warnings if it is outdated code. C is an outdated language anyway these days, it's a fun little book and I'd hate to just let it sit in my closet or something. Thanks for the help. |
|
|
|
|
|
#2 |
|
Sexy Programmer
|
What is the name of the book?
__________________
I would love to change the world, but they won't give me the source code! |
|
|
|
|
|
#3 | |
|
Newbie
Join Date: Jul 2006
Location: Pepperland
Posts: 16
Rep Power: 0
![]() |
Right here:
Quote:
|
|
|
|
|
|
|
#4 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
In the absence of contrary information from a declaration (prototype), C presumes an integer argument and an integer return. C++, of course, does not. If you think that's bad, find something old that defines the argument types outside the parentheses and before the body. While you may be correct in stating that C is outdated, that's kind of a relative statement. An MGTD (for example) is outdated, but people seek furiously after them. The reports of C's death are highly exaggerated.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Jul 2006
Location: Pepperland
Posts: 16
Rep Power: 0
![]() |
Yeah, I suppose so. Considering that most of the Windows OS is written in C (kernel, libs, etc.) as well as Linux entirely (and GNU I think) is written in C it's a good bet that it won't "die" too soon I suppose. I just meant in popularity for the average programmer I suppose - no operating system coding, although game development is heading towards a solid C++ state I think, back in the Doom days everything was C.
Anyhoo, I read through the C wiki and found out that the second edition of K&R's C book was written in 1988 (covers ansi c) and the first edition in 1974 I'll place my bets on that the book I bought is recent enough, considering it had 6 years to get with the times on the well documented ANSI C. Thanks for the quick replies. |
|
|
|
|
|
#6 |
|
Sexy Programmer
|
lol, you would like that the author would teach you the Standard C? I brought the K&R's book on C on eBay for about $25. It was in really good condition, maybe you might want to try to look for another resource if you feel the book is outdated.
Btw, on Amazon, they have the 2nd edition of that book for $14.99 and it was published in 1994 so maybe this one would have the Standard C.
__________________
I would love to change the world, but they won't give me the source code! |
|
|
|
|
|
#7 |
|
Newbie
Join Date: Jul 2006
Location: Pepperland
Posts: 16
Rep Power: 0
![]() |
It is the second edition, sorry I should have mentioned that.
Want kind of tomfoolery is Barnes and Noble playing here? I was overcharged by 5 dollars, bah. Everyone has to make a profit I suppose. Besides that, it wasn't on me as I received a gift certificate for my belated birthday whooo. Sure, I can always get excellent resources through About and cprogramming's tuts but I am a sucker for a good book. I guess it's the principle of the matter, I'll stick with the book and move around afterwards, learning won't hurt me. I really like the layout as it doesn't completely insult you like the Dummies series does with unfunny comics and it doesn't talk to you as if you were 3 years of age. Well I'm going out for the evening, thanks. |
|
|
|
|
|
#8 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
I don't know the particular book, but there is a reasonable chance a book copyrighted 1994 will probably be up to date with the first C standard (which was ratified by ANSI in 1989 and ISO in 1990). It has virtually no chance of being current with the latest C standard, which came out in 1999.
The rule of "return type of a function is int if not specified" predates the 1989 C standard, but was allowed by the 1989 C standard for reasons of backward compatibility. I'm not sure offhand if it is still supported by the 1999 C standard. |
|
|
|
|
|
#9 |
|
Professional Programmer
![]() Join Date: Sep 2005
Posts: 419
Rep Power: 4
![]() |
>If it helps the book is The Absolute Beginners Guide to C
If that's the one by Greg Perry, I'm familiar with it. Even at the time of writing it was crap, and it's even more so now. Pick up "The C Programming Language" or "Pointers on C". I've heard good things about "C Programming: A Modern Approach", but I haven't done more than flip through it at the bookstore.>I'm not sure offhand if it is still supported by the 1999 C standard. No, implicit int was removed in C99.
__________________
Even if the voices aren't real, they have some pretty good ideas. |
|
|
|
|
|
#10 |
|
Expert Programmer
Join Date: Dec 2004
Posts: 794
Rep Power: 4
![]() |
Narue what in the world is that Elflike chick in your avatar?
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials. --WilliamSChips on Slashdot |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Java Book | coldDeath | Java | 11 | Oct 11th, 2006 2:52 AM |
| book review forum | bl00dninja | Community Announcements and Feedback | 19 | Apr 26th, 2006 3:39 AM |
| Having trouble with an exercise in the C book. | linuxpimp20 | C | 6 | Jul 6th, 2005 8:22 AM |
| Is there a mid-level C++ book? | nez | C++ | 18 | May 30th, 2005 7:03 AM |
| Book about general progamming concepts. | linuxpimp20 | Other Programming Languages | 1 | May 23rd, 2005 4:47 PM |