![]() |
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>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. |
What is the name of the book?
|
Right here:
Quote:
|
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.
|
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. |
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. |
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. |
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. |
>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. |
Narue what in the world is that Elflike chick in your avatar?
|
| All times are GMT -5. The time now is 12:22 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC