Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 23rd, 2006, 8:26 PM   #1
George Harrison
Newbie
 
George Harrison's Avatar
 
Join Date: Jul 2006
Location: Pepperland
Posts: 16
Rep Power: 0 George Harrison is on a distinguished road
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.
George Harrison is offline   Reply With Quote
Old Aug 23rd, 2006, 8:32 PM   #2
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 4 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
What is the name of the book?
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old Aug 23rd, 2006, 8:37 PM   #3
George Harrison
Newbie
 
George Harrison's Avatar
 
Join Date: Jul 2006
Location: Pepperland
Posts: 16
Rep Power: 0 George Harrison is on a distinguished road
Right here:

Quote:
Originally Posted by George Harrison
If it helps the book is The Absolute Beginners Guide to C
George Harrison is offline   Reply With Quote
Old Aug 23rd, 2006, 8:44 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Aug 23rd, 2006, 8:52 PM   #5
George Harrison
Newbie
 
George Harrison's Avatar
 
Join Date: Jul 2006
Location: Pepperland
Posts: 16
Rep Power: 0 George Harrison is on a distinguished road
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.
George Harrison is offline   Reply With Quote
Old Aug 23rd, 2006, 9:13 PM   #6
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 4 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
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!
ReggaetonKing is offline   Reply With Quote
Old Aug 23rd, 2006, 9:33 PM   #7
George Harrison
Newbie
 
George Harrison's Avatar
 
Join Date: Jul 2006
Location: Pepperland
Posts: 16
Rep Power: 0 George Harrison is on a distinguished road
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.
George Harrison is offline   Reply With Quote
Old Aug 23rd, 2006, 9:36 PM   #8
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5 grumpy will become famous soon enough
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.
grumpy is offline   Reply With Quote
Old Aug 24th, 2006, 9:56 AM   #9
Narue
Professional Programmer
 
Narue's Avatar
 
Join Date: Sep 2005
Posts: 419
Rep Power: 4 Narue is on a distinguished road
>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.
Narue is offline   Reply With Quote
Old Aug 24th, 2006, 11:30 AM   #10
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
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
uman is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:39 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC