By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,098 Members | 1,881 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,098 IT Pros & Developers. It's quick & easy.

Is "C For Dummies" any good?

P: n/a
Hello everyone.

I am new to programming and my uncle gave me a copy of "C For Dummies
2nd Edition". I am up to chapter 9 right now. He probably saw me
struggling with "The C Programming Language" by Ritchie and Kernigahn
and felt bad.

Does anyone have experience with this book? I feel that it is helping me
along pretty well. But how much will this book teach me? What would be
the next book to read?

--
K. G. Suarez

Nov 14 '05 #1
Share this Question
Share on Google+
60 Replies


P: n/a
On Sat, 24 Jul 2004 17:37:38 -0400, K. G. Suarez wrote:
Hello everyone.

I am new to programming and my uncle gave me a copy of "C For Dummies
2nd Edition". I am up to chapter 9 right now. He probably saw me
struggling with "The C Programming Language" by Ritchie and Kernigahn
and felt bad.

Does anyone have experience with this book? I feel that it is helping me
along pretty well. But how much will this book teach me? What would be
the next book to read?

In my experience XXX for dummies are best avoided.

Nov 14 '05 #2

P: n/a
Hi, Nils.

Can you explain to me why I should avoid the book? Can you recommend a
better book, or one that I should read after?

--
K. G. Suarez

Nov 14 '05 #3

P: n/a
"K. G. Suarez" <kg****@bellsouth.net> wrote in message
news:qC*******************@bignews6.bellsouth.net. ..
Hi, Nils.

Can you explain to me why I should avoid the book? Can you recommend a
better book, or one that I should read after?

--
K. G. Suarez


Why not finish the book then have a go at k & r again afterwards?
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.715 / Virus Database: 471 - Release Date: 7/4/2004
Nov 14 '05 #4

P: n/a
That's what I was thinking. But is there a better book than K&R's?

Odyssey wrote:
Why not finish the book then have a go at k & r again afterwards?


--
K. G. Suarez

Nov 14 '05 #5

P: n/a
"K. G. Suarez" <kg****@bellsouth.net> wrote in message
news:rE*****************@bignews2.bellsouth.net...
Hello everyone.

I am new to programming
Then I recommend you give C a miss until you're more familiar with
structured programming languages.
and my uncle gave me a copy of "C For Dummies
2nd Edition". I am up to chapter 9 right now. He probably saw me
struggling with "The C Programming Language" by Ritchie and Kernigahn
and felt bad.

Does anyone have experience with this book? I feel that it is helping me
along pretty well.
Then use it. Just be aware that many books are not teaching you strict C but
instead teach a variant that the author is familiar with, and which may not
work on other machines.

Read your book first, then read K&R2 which is likely to be closer to the C89
standard on which it is based [Except for Chapter 8.]

You can scan ACCU's reviews at...

http://www.accu.org/bookreviews/public/index.htm

But bare in mind that many reviews are not exactly objective or
authoritative. The one for your book (although possibly an earlier edition)
is a classic case in point.
But how much will this book teach me? What would be
the next book to read?


Everyone has their own learning styles. Asking lots of people for their
opinions will only get you so far. In the end, YOU'RE the one doing the
reading so it's important that you get a book that suites YOU, not the
majority of OTHER people.

Note that a _good_ book will state it's objectives and target audience early
on, either in the preface or the introduction.

A good way to assess books is to scan them for sections on topics which you
found difficult under previous texts. If it explains that topic well, then
in all likelihood it will be suited to you. You can also scan for common
mistakes. Read the CLC FAQ for examples. If a book seems to be making many
mistakes covered by the FAQ, then it's probably best avoided.

--
Peter
Nov 14 '05 #6

P: n/a
In article <rE*****************@bignews2.bellsouth.net>,
K. G. Suarez <kg****@bellsouth.net> wrote:
Hello everyone.

I am new to programming and my uncle gave me a copy of "C For Dummies
2nd Edition". I am up to chapter 9 right now. He probably saw me
struggling with "The C Programming Language" by Ritchie and Kernigahn
and felt bad.

Does anyone have experience with this book? I feel that it is helping me
along pretty well. But how much will this book teach me? What would be
the next book to read?


I suggest that you don't read "C For Dummies". It has the potential
to mislead you.

I am basing this statement based on the author's VERY confused
rambling in:

http://www.c-for-dummies.com/lessons.../01/index.html

He shows a program that compiles and runs under Windows but
crashes under Linux. He appears to puzzled why this happens.

His problem is that he is trying to modify a string literal.
That's in violation of the C standard.

This is Question 1.32 in comp.lang.c's FAQ.

At least he should be given credit for his honesty.

--
rr
Nov 14 '05 #7

P: n/a
Peter Nilsson wrote:
Then I recommend you give C a miss until you're more familiar with
structured programming languages.
My uncle recommended that I start out with something more simple too. So
I tried out "Python". It was confusing. I still don't understand what
it's good for. I don't want to waste my time on it.
Then use it. Just be aware that many books are not teaching you strict C but
instead teach a variant that the author is familiar with, and which may not
work on other machines.
Should I learn C or not? My machine (not the one I am posting this
message with. I am upgrading it right now.) runs on FreeBSD. So far
everything in the book is working on it.
Read your book first, then read K&R2 which is likely to be closer to the C89
standard on which it is based [Except for Chapter 8.]
Okay.
You can scan ACCU's reviews at...

http://www.accu.org/bookreviews/public/index.htm

But bare in mind that many reviews are not exactly objective or
authoritative. The one for your book (although possibly an earlier edition)
is a classic case in point.


That review is for another book. Mine is not a set of 2. I wish I knew
what the difference was between this one and mine.

--
K. G. Suarez

Nov 14 '05 #8

P: n/a
On Sun, 25 Jul 2004 00:03:11 -0400, K. G. Suarez <kg****@bellsouth.net> wrote:


Peter Nilsson wrote:
Then I recommend you give C a miss until you're more familiar with
structured programming languages.


My uncle recommended that I start out with something more simple too. So
I tried out "Python". It was confusing. I still don't understand what
it's good for. I don't want to waste my time on it.


Try bash. It's very useful for system administration and contains
many of the basic constructs found in C. (or any programming language).

Its a "high-level" language of utiliatarian value, although you can
write very cool programs with it if you want. They run faster in C
as a rule, which is often irrelevant.

No compiler necessary. Very easy to play with.

You'd need the OREILLY book "Learning the bash Shell" (cheap if you get a
used copy on Amazon) 2nd Edition, and the Advanced Bash Shell Scripting Guide:

Linux Documentation Project:
http://www.tldp.org/LDP/abs/html/
http://www.tldp.org/LDP/abs/html/index.html
http://www.tldp.org/LDP/abs/abs-guide.html.tar.gz
http://www.tldp.org/LDP/abs/abs-guide.pdf

Sunsite:
http://www.ibiblio.org/pub/Linux/doc...ect/abs-guide/
Postscript --

http://www.ibiblio.org/pub/Linux/doc...bs-guide.ps.gz

Text --

http://www.ibiblio.org/pub/Linux/doc...s-guide.txt.gz

And the comp.unix.shell FAQ:

http://home.comcast.net/~j.p.h/

http://groups.google.com/groups?selm=dr%9c.126330$_w.1560787@attbi_s53

-------------

There's also the man page and the FAQ and The GNU Bash Reference Manual and
tutorials on the web by the dozens.

Since you are running Windoze, install cygwin or gnuwin (POSIX/Unix emulators).
Or get Knoppix, which is on a CD and loads up a complete Linux OS in a ramdisk,
never touching your hard drive.

For basic training in Linux see http://rute.sourceforge.net

The first 9 chapters or so.

This would be a very good move. Windoze sucks. Been there. C is C, whether
you are using GCC (the Gnu compiler collection) on Linux or the MS C++
compiler.

Linux is free, too. Just download any of the above from the Internet.

<snip>

AC

Nov 14 '05 #9

P: n/a
[snip]
Does anyone have experience with this book? I feel that it is helping me
along pretty well. But how much will this book teach me? What would be
the next book to read?


"Expert C programming - Deep C secrets" by Peter Van Der Linden is a
good book, but as the author himself says - it should be the "second
book" on C.
Nov 14 '05 #10

P: n/a
On Sat, 24 Jul 2004 21:00:14 -0400, K. G. Suarez wrote:
Hi, Nils.

Can you explain to me why I should avoid the book? Can you recommend a
better book, or one that I should read after?


Aside from the possibility that the author may have provided some bad code
in an example, as posted above, no. Books sometimes have poor examples,
but I would say that in as long as that is the only one, it is probably OK
to use it as a starting point.

The thing is, just make sure you don't get trapped in the simplified view
of the C language that it provides. Remember that it is a 'baby steps'
kind of book, and that there is far more to C than what it describes. We
all have to start somewhere, and generally we need to crawl before we can
walk before we can run. So as long as you remember that, use it as a
starting point.

That said, a book I found very well written and structured for both
learning and as a reference was: 'The Indispensable Guide to C' by Paul
Davies. It was/is published by Addison Wesley and can be purchased on
Amazon. It says 'with Engineering Applications' at the bottom, but don't
let that worry you. It is very well laid out, and has excellent examples.
Actually for learning, I would say it is awesome. :-)

Here is the Amazon link... good luck with your learning!

http://www.amazon.com/exec/obidos/tg...roduct-details

Nov 14 '05 #11

P: n/a

"K. G. Suarez" <kg****@bellsouth.net> wrote in message

Should I learn C or not? My machine (not the one I am posting this
message with. I am upgrading it right now.) runs on FreeBSD. So far
everything in the book is working on it.

You won't go far as a programmer without knowing C.

However it isn't an ideal first language, mainly because of the pointer
syntax. You also have the problem that graphics libraries are add-ons, and
most starting programmers like to produce some graphics to give a sense of
achievement. Personally I would recommend learning a beginner's language to
start with, maybe Visual Basic.

However I wouldn't say it is necessarily a disaster to learn C first.
Nov 14 '05 #12

P: n/a
Malcolm <ma*****@55bank.freeserve.co.uk> scribbled the following:
"K. G. Suarez" <kg****@bellsouth.net> wrote in message
Should I learn C or not? My machine (not the one I am posting this
message with. I am upgrading it right now.) runs on FreeBSD. So far
everything in the book is working on it.
You won't go far as a programmer without knowing C.


It depends. I have got quite far mostly knowing Java. I know C, but it
hasn't really come into use in either of my jobs so far.
However it isn't an ideal first language, mainly because of the pointer
syntax. You also have the problem that graphics libraries are add-ons, and
most starting programmers like to produce some graphics to give a sense of
achievement. Personally I would recommend learning a beginner's language to
start with, maybe Visual Basic.
My first language was BASIC, followed by Pascal, then Java and later C.
I didn't learn Java that well at first, in fact I was horrible at it.
But I learned C quickly enough. Then I went into advanced Java courses
and learned much more about it.
However I wouldn't say it is necessarily a disaster to learn C first.


--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"A bee could, in effect, gather its junk. Llamas (no poor quadripeds) tune
and vow excitedly zooming."
- JIPsoft
Nov 14 '05 #13

P: n/a

"K. G. Suarez" <kg****@bellsouth.net> wrote in message
news:rE*****************@bignews2.bellsouth.net...
Hello everyone.

I am new to programming and my uncle gave me a copy of "C For Dummies
2nd Edition". I am up to chapter 9 right now. He probably saw me
struggling with "The C Programming Language" by Ritchie and Kernigahn
and felt bad.

Does anyone have experience with this book? I feel that it is helping me
along pretty well. But how much will this book teach me? What would be
the next book to read?

--
K. G. Suarez


Greetings,

I too am new to programming, and I am also using the "C for Dummies" (2nd
edition) book to get started. I am finding it very usefull, as the book is
in no way intimidating (perfect for us newcomers!). I think it is the
perfect *starting* resource. I plan to go through it and then move on to
K&R2. For now, I am enjoying creating the small programs from the book and I
am getting a great sense of programming structure as well. This material
teaches only the tip of the C language. However, isn't that exactly what a
new programmer needs to begin with?

Best,
newby2c
Nov 14 '05 #14

P: n/a
"K. G. Suarez" <kg****@bellsouth.net> wrote:
That's what I was thinking. But is there a better book than K&R's?


Arguably, H&S.

--
Dan Henry
Nov 14 '05 #15

P: n/a
In article <cd*********@enews4.newsguy.com>, se******@juno.com says...
I too am new to programming, and I am also using the "C for Dummies" (2nd
edition) book to get started. I am finding it very usefull, as the book is
in no way intimidating (perfect for us newcomers!). I think it is the
perfect *starting* resource. I plan to go through it and then move on to
K&R2. For now, I am enjoying creating the small programs from the book and I
am getting a great sense of programming structure as well. This material
teaches only the tip of the C language. However, isn't that exactly what a
new programmer needs to begin with?


As long as you are willing to accept that you may be learning some things
that are not strictly correct, may not work on every machine you try them,
and may in fact have to be "unlearned" when you move on to the "next book",
then it isn't a problem. If instead you take it all as factual, you may
be in for a rough ride if you stick with the language long term.

--
Randy Howard
To reply, remove FOOBAR.
Nov 14 '05 #16

P: n/a
"Randy Howard" <ra*********@FOOverizonBAR.net> wrote in message
news:MP************************@news.verizon.net.. .
In article <cd*********@enews4.newsguy.com>, se******@juno.com says...
I too am new to programming, and I am also using the "C for Dummies" (2nd edition) book to get started. I am finding it very usefull, as the book is in no way intimidating (perfect for us newcomers!). I think it is the
perfect *starting* resource. I plan to go through it and then move on to
K&R2.


I think you and the OP are making a fine decision in using a "Dummies" book.
I have several that I use for things I know quite well, as they are quick
and easy to use to find basic info. I flip through my "HTML (or DHTML) 4
Dummies" all the time for the basic syntax or quick JavaScript templates for
something I'll flesh out later. "SQL 4 Dummies" is great for remembering how
to do a basic inner join, etc.

When you get to the K&R book ("The Bible"), try to remember that you don't
need to completely understand every nuance the first time through. Also, if
you get bogged down on something (like, chapter 5 for instance -> pointers)
you can skip ahead and read the rest of the book. The previous chapters may
make more sense after you've seen what lies ahead. Do the exercises! Study
the examples! They say more than you'd think, as they are subtle and
elegant. Understand every line before moving on (wait, does that contradict
what I just said about skipping ahead...?)

--
Mabden
Nov 14 '05 #17

P: n/a

Mabden, please get your attributions correct, I did NOT write
what you are replying to below... and yes, this is an intentional
top-post, since the contents are incorrect below.

In article <kb***************@newssvr27.news.prodigy.com>,
mabden@sbc_global.net says...
"Randy Howard" <ra*********@FOOverizonBAR.net> wrote in message
news:MP************************@news.verizon.net.. .
In article <cd*********@enews4.newsguy.com>, se******@juno.com says...
I too am new to programming, and I am also using the "C for Dummies" (2nd edition) book to get started. I am finding it very usefull, as the book is in no way intimidating (perfect for us newcomers!). I think it is the
perfect *starting* resource. I plan to go through it and then move on to
K&R2.

--
Randy Howard
To reply, remove FOOBAR.
Nov 14 '05 #18

P: n/a

"Randy Howard" <ra*********@FOOverizonBAR.net> wrote in message
news:MP************************@news.verizon.net.. .
As long as you are willing to accept that you may be learning some things
that are not strictly correct, may not work on every machine you try them,
and may in fact have to be "unlearned" when you move on to the "next book", then it isn't a problem. If instead you take it all as factual, you may
be in for a rough ride if you stick with the language long term.

--
Randy Howard
To reply, remove FOOBAR.


Greetings Randy,

I've heard many people say that very same thing. I wonder, could you please
site an example of something in CfDummies(2) that is not "strictly correct",
etc.? I'm curious to know what these items could possibly be. Being a
confessed newby2c, I understand the possibility of being *molded* by my
first book on the subject. However, with this group here and other books I
have (K&R2 for example), I am confident that I could remain flexible enough
to accept a new learning curve if need be. Anyway, thanks for posting with
your input. I'm sure the OP has had gotten his answer by now.

Best,
newby2c
Nov 14 '05 #19

P: n/a

"Mabden" <mabden@sbc_global.net> wrote in message
news:kb***************@newssvr27.news.prodigy.com. ..
I think you and the OP are making a fine decision in using a "Dummies" book. I have several that I use for things I know quite well, as they are quick
and easy to use to find basic info. I flip through my "HTML (or DHTML) 4
Dummies" all the time for the basic syntax or quick JavaScript templates for something I'll flesh out later. "SQL 4 Dummies" is great for remembering how to do a basic inner join, etc.

When you get to the K&R book ("The Bible"), try to remember that you don't
need to completely understand every nuance the first time through. Also, if you get bogged down on something (like, chapter 5 for instance -> pointers) you can skip ahead and read the rest of the book. The previous chapters may make more sense after you've seen what lies ahead. Do the exercises! Study
the examples! They say more than you'd think, as they are subtle and
elegant. Understand every line before moving on (wait, does that contradict what I just said about skipping ahead...?)

--
Mabden


Greetings Mabden,

Thanks for the encouraging input. I agree that the "Dummies" series is a
great *first resource* for many of the more complex issues and projects out
there (of which the 'C' language is definitely one of!). I've recently
become a hockey fan and know absolutely nothing about the game. So, I picked
up "Hockey for Dummies" and now I'm learning all about the history, players,
positions, tactics, etc. And all in a very user friendly way. But there is
one item I have as yet to mention. I am having FUN learning the 'C'
language! I am not intimidated. I understand clearly everything being
taught. I get to laugh at many of the authors humurous rantings. And also, I
am actually coding small programs that work! Not just the ones in the book
either. Sometimes when I learn something new, it gives me ideas of how I can
implement it, and wouldn't you know, I've even made a few programs up myself
(proud grin).

Take care,
newby2c
Nov 14 '05 #20

P: n/a
"Randy Howard" <ra*********@FOOverizonBAR.net> wrote in message
news:MP************************@news.verizon.net.. .

Mabden, please get your attributions correct, I did NOT write
what you are replying to below... and yes, this is an intentional
top-post, since the contents are incorrect below.


Shit happens.

--
Mabden
Nov 14 '05 #21

P: n/a

"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
You won't go far as a programmer without knowing C.


It depends. I have got quite far mostly knowing Java. I know C, but it
hasn't really come into use in either of my jobs so far.

But you still have to know C, even if you don't use it as your main
development language. For instance have you never needed to translate a
routine written in C into Java?
Nov 14 '05 #22

P: n/a
In article <ar**************@newssvr27.news.prodigy.com>, mabden@sbc_global.net
says...
"Randy Howard" <ra*********@FOOverizonBAR.net> wrote in message
news:MP************************@news.verizon.net.. .

Mabden, please get your attributions correct, I did NOT write
what you are replying to below... and yes, this is an intentional
top-post, since the contents are incorrect below.


Shit happens.


As you so amply demonstrate, yes.

--
Randy Howard
To reply, remove FOOBAR.
Nov 14 '05 #23

P: n/a
What are your programs like so far? All I can do is modify code. People
have said that it is good to look at others people's code. So what I am
doing now is: I download some code and then look thought it, when I find
something I don't recognize, I look it up in K&R.

Is this a good way to learn? Back when I tried to learn from K&R, and
even now with "C For Dummies", I have had trouble understanding what the
text is talking about. I usually have no clue what's going on until I
see the code. Should I open up K&R, find some nice big piece of code and
try to figure out what's going on? How have some of you learned? Should
I sign up for a class? I don't want a class where I will have to use a
Windows machine. I like to use my FreeBSD machine for stuff like this.
And I don't care for GUI related stuff. I am perfectly fine with CLI.

Speaking of my FreeBSD machine... I can't post to this newsgroup with
it. I have no idea what the problem is... I can post to some other
newsgroups. Does anyone know what's up?

--
K. G. Suarez

Nov 14 '05 #24

P: n/a
[K. G. Suarez] wrote ...
What are your programs like so far? All I can do is modify code.


Greetings K.G.,

I'm not sure you were directing your message to me, but I think you were.
Anyway, here is some code I wrote with the knowledge gained so far, from "C
for Dummies". It is a program that converts U.S. dollars into British
pounds. Not bad for a complete newby2c. And I'm only on chapter 9!

-------------- begin code ----------------------
/* currency.c */

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
float us=1.00;
float total;

printf("%50s","Currency Converter\n");
printf("\n");
printf("Enter amount in U.S. currency to convert: ");
scanf("%f",&us);
total=us*0.586550;
printf("\n");
printf("The total amount in British Pounds is %.2f\n",total);

system("pause");

return 0;
}
----------------- end of code -------------------

I hope this helps you some.

Best,
newby2c
Nov 14 '05 #25

P: n/a
newby2c wrote on 26/07/04 :
/* currency.c */

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
Why defining parameters you don't use at all ?
{
float us=1.00;
Why using 'float' instead of 'double' ?
float total;

printf("%50s","Currency Converter\n");
printf("\n");
printf("Enter amount in U.S. currency to convert: ");
(FAQ) The string is not terminated by a '\n'. Depending on the
platform, it may output on stdout or not. To be sure of it, force it:

fflush (stdout);
scanf("%f",&us);
What happens if the user types a wrong entry ? scanf() is a difficult
function, not only for beginners. I suggest a combination of fgets()
and strtod().
total=us*0.586550;
What if the rate changes ?
printf("\n");
printf("The total amount in British Pounds is %.2f\n",total);

system("pause");
Bare in mind that this 'trick' is due to your C implementation.
return 0;
}


--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html

"C is a sharp tool"

Nov 14 '05 #26

P: n/a
K. G. Suarez wrote:
Hello everyone.

I am new to programming and my uncle gave me a copy of "C For
Dummies 2nd Edition". I am up to chapter 9 right now. He probably
saw me struggling with "The C Programming Language" by Ritchie and
Kernigahn and felt bad.

Does anyone have experience with this book? I feel that it is
helping me along pretty well. But how much will this book teach
me? What would be the next book to read?


My suggestion:

If you feel good with the book = it pleases you and you like the
style how it is written, then go ahead with it.

Don't expect that you'll be master of the C universe after you have
finished with you reading.

Learning C is (like learning any spoken language) learning
syntactical elements, semantical rules and then develop a living
style.
You may learn syntactical elements and some semantical rules from
such a book. Reading another one might add to your knowledge.

But at some certain point you have to made that decision, that
either you drop this language, or start living with it.

As soon as you make up your mind to make this language part of your
life, you'll start to really "learn C".

You'll stop reading books, you'll start reading code from other
developers, creating code by yourself, getting it criticized by
others, redoing it at a whole or part of it, and sometimes throw it
away after lots of wasted hours and days.

Years later, you might end up as a good programmer,
either because you started with a book like "C For Dummies" -
or because you dropped it and started with any other.

There are three important things:
from any hint anybody gives you, retrieve the good part and keep it.
from the same hint, retrieve the bad part, and ignore it.
go ahead with what you think is the best.

Bernhard
Nov 14 '05 #27

P: n/a
Thank you, Bernhard. I will keep that in mind

--
K. G. Suarez
Nov 14 '05 #28

P: n/a
Malcolm <ma*****@55bank.freeserve.co.uk> scribbled the following:
"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
> You won't go far as a programmer without knowing C.


It depends. I have got quite far mostly knowing Java. I know C, but it
hasn't really come into use in either of my jobs so far.

But you still have to know C, even if you don't use it as your main
development language. For instance have you never needed to translate a
routine written in C into Java?


Yes I have. But only once so far. And it was fairly simple C, with most
of the difficulty being in the algorithm itself.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"'It can be easily shown that' means 'I saw a proof of this once (which I didn't
understand) which I can no longer remember'."
- A maths teacher
Nov 14 '05 #29

P: n/a
In article <ce*********@enews4.newsguy.com>, newby2c <se******@juno.com> wrote:
[K. G. Suarez] wrote ...
I'm not sure you were directing your message to me, but I think you were.
Anyway, here is some code I wrote with the knowledge gained so far, from "C
for Dummies". It is a program that converts U.S. dollars into British
pounds. Not bad for a complete newby2c. And I'm only on chapter 9! ....snipped... printf("Enter amount in U.S. currency to convert: ");
This needs to be followed by
fflush(stdout);

....more snipped... system("pause");


Did the book tell you that "pause" is avaialble only on certain platforms?

--
rr
Nov 14 '05 #30

P: n/a

"Joona I Palaste" <pa*****@cc.helsinki.fi> wrote in message
But you still have to know C, even if you don't use it as your main
development language. For instance have you never needed to translate a
routine written in C into Java?


Yes I have. But only once so far. And it was fairly simple C, with most
of the difficulty being in the algorithm itself.

I suppose it depends what sort of programs you write. Stealing snippets of
code is something I do constantly.
Nov 14 '05 #31

P: n/a


Rouben Rostamian wrote:
In article <rE*****************@bignews2.bellsouth.net>,
K. G. Suarez <kg****@bellsouth.net> wrote:
Hello everyone.

I am new to programming and my uncle gave me a copy of "C For Dummies
2nd Edition". I am up to chapter 9 right now. He probably saw me
struggling with "The C Programming Language" by Ritchie and Kernigahn
and felt bad.

Does anyone have experience with this book? I feel that it is helping me
along pretty well. But how much will this book teach me? What would be
the next book to read?


I suggest that you don't read "C For Dummies". It has the potential
to mislead you.

I am basing this statement based on the author's VERY confused
rambling in:

http://www.c-for-dummies.com/lessons.../01/index.html

He shows a program that compiles and runs under Windows but
crashes under Linux. He appears to puzzled why this happens.

His problem is that he is trying to modify a string literal.
That's in violation of the C standard.

This is Question 1.32 in comp.lang.c's FAQ.

At least he should be given credit for his honesty.


I like how he blames in on linux.
Nov 14 '05 #32

P: n/a
Test.

--
K. G. Suarez
Nov 14 '05 #33

P: n/a
In article <20*********************@Penny.Mine.org>,
K. G. Suarez <kg****@bellsouth.net> wrote:
Test.

--
K. G. Suarez


You fail. Go to alt.test. Go directly to alt.test. Do not pass Go.
Do not collect $200.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.ca
Texas doesn't even rate by .us standards. I think their whole state
could practically fit into the *parks* in Alaska.
--J.D. Baldwin in the scary devil monastery
Nov 14 '05 #34

P: n/a
"Emmanuel Delahaye" <em***@YOURBRAnoos.fr> wrote in message
news:mn***********************@YOURBRAnoos.fr...
[snip]
Why defining parameters you don't use at all ?
[snip] Why using 'float' instead of 'double' ?
[snip] (FAQ) The string is not terminated by a '\n'. Depending on the
platform, it may output on stdout or not. To be sure of it, force it:

fflush (stdout);
[snip] What happens if the user types a wrong entry ? scanf() is a difficult
function, not only for beginners. I suggest a combination of fgets()
and strtod().
[snip] What if the rate changes ?
[snip] Bare in mind that this 'trick' is due to your C implementation.


Greetings Emmanuel,

I think you may have missed an earlier post of mine in this thread, or maybe
just misunderstood it, so I'll post it again. I am brand new to any type of
programming, and I've only read nine chapters (small ones too) of an
incredibly basic approach to the C language. The only reason I even posted
that code was to show the OP how to put into practical use what was being
taught. He mentioned that he was only able to work and alter pre-made code,
and asked me what I was doing. With that said, I will try to answer your
questions.

#1. This was done by the DevC++ editor after I chose the option to create a
new project (console). Yes, I could have and should have, just used int
main().

#2. Why use 'double'? I wrote this program for myself to determine the cost
of an eBay auction that was in British pounds (this was before eBay provided
that info). I knew I would not be entering anything requiring 'double'.

#3. Sorry, I didn't get that far yet, so I made use of what I knew. I'll be
on the lookout for that though.

#4. I agree 100% with you on this. However, as above, I haven't yet learned
any other way of doing it yet.

#5. I was, and am aware of that, and it frustrates the hell out of me. As a
matter of fact, it does change quite often. What do you suggest?

#6. Yes, I understand that it is not very portable. But again, it was only
for my use (I know, that's no excuse), and it was really fun to go through
the thought process for designing it.

Best,
newby2c
Nov 14 '05 #35

P: n/a
"Rouben Rostamian" <ro****@pc18.math.umbc.edu> wrote in message
news:ce**********@pc18.math.umbc.edu...
printf("Enter amount in U.S. currency to convert: ");


This needs to be followed by
fflush(stdout);

...more snipped...
system("pause");


Did the book tell you that "pause" is avaialble only on certain platforms?


Greetings Rouben,

Please see my reply to Emmanuel.

Thanks.
Nov 14 '05 #36

P: n/a
"newby2c" <se******@juno.com> writes:
[...]
#1. This was done by the DevC++ editor after I chose the option to create a
new project (console). Yes, I could have and should have, just used int
main().
Or, better yet, int main(void).
#2. Why use 'double'? I wrote this program for myself to determine the cost
of an eBay auction that was in British pounds (this was before eBay provided
that info). I knew I would not be entering anything requiring 'double'.


Type double typically has a greater range *and* precision than float
(though this isn't guaranteed). If you're dealing with reasonable
amounts of money, the extra range isn't going to matter, but the
precision could. Typical amounts of money (such as 0.10) aren't
exactly representable in binary floating-point. Using double rather
than float can alleviate, but not solve, this problem. See section 14
of the C FAQ, <http://www.eskimo.com/~scs/C-faq/faq.html>.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #37

P: n/a
"Bernhard Holzmayer" <ho****************@deadspam.com> wrote in message
news:17*****************@holzmayer.ifr.rt...
My suggestion:

If you feel good with the book = it pleases you and you like the
style how it is written, then go ahead with it.


[snip]

Greetings Bernhard,

I know you wrote this to the OP and not I, but I just wanted to say that you
gave some great advice, and as a neophyte myself, I intend to follow it.

Best,
newby2c
Nov 14 '05 #38

P: n/a
newby2c wrote on 26/07/04 :
Why defining parameters you don't use at all ?
#1. This was done by the DevC++ editor after I chose the option to create a
new project (console). Yes, I could have and should have, just used int
main().
Ok, or int main (void)

that clarifies your intention.
Why using 'float' instead of 'double' ?


#2. Why use 'double'? I wrote this program for myself to determine the cost
of an eBay auction that was in British pounds (this was before eBay provided
that info). I knew I would not be entering anything requiring 'double'.


double are used for computing because they have a better precision. Any
float will be converted to a double (with a cost in terms of code space
and CPU time) before being processed (computing, function parameter
etc.).

Better to have it as the basic type that double is. float being
generally smaller (hence less accurate) than double, they are used to
store big arrays of values when high precision is less required than
room.

Note that if you inist in using scanf() with the address of a double,
the correct formatter is "%lf". (point #4)
(FAQ) The string is not terminated by a '\n'. Depending on the
platform, it may output on stdout or not. To be sure of it, force it:

fflush (stdout);


#3. Sorry, I didn't get that far yet, so I made use of what I knew. I'll be
on the lookout for that though.


It is well explained in the FAQ. It's an implementation-dependent issue
that concerns portability. Don't forget that here, on c.l.c, we are
speaking of the C-language, independently from any implementation.
Hence, we try to stay portable.
What happens if the user types a wrong entry ? scanf() is a difficult
function, not only for beginners. I suggest a combination of fgets()
and strtod().


#4. I agree 100% with you on this. However, as above, I haven't yet learned
any other way of doing it yet.


I still don't understand why book writers do continue to teach scanf()
before gets()... Kinda mystery to me...
What if the rate changes ?


#5. I was, and am aware of that, and it frustrates the hell out of me. As a
matter of fact, it does change quite often. What do you suggest?


At minimum, a command line parameter to avoid to recompile the program
each times! Incidently, it will give you the opportunity to learn how
to manage the command line parameters and the

int main (int parameters_count, char ** array_of_strings)

form of main.
Bare in mind that this 'trick' is due to your C implementation.

#6. Yes, I understand that it is not very portable. But again, it was only
for my use (I know, that's no excuse), and it was really fun to go through
the thought process for designing it.


We are not supposed to post system dependent code in here.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html

"C is a sharp tool"

Nov 14 '05 #39

P: n/a
"Keith Thompson" <ks***@mib.org> wrote in message
news:ln************@nuthaus.mib.org...
Type double typically has a greater range *and* precision than float
(though this isn't guaranteed). If you're dealing with reasonable
amounts of money, the extra range isn't going to matter, but the
precision could. Typical amounts of money (such as 0.10) aren't
exactly representable in binary floating-point. Using double rather
than float can alleviate, but not solve, this problem. See section 14
of the C FAQ, <http://www.eskimo.com/~scs/C-faq/faq.html>.


Thanks for the explanation, Keith.

newby2c
Nov 14 '05 #40

P: n/a
Emmanuel Delahaye <em***@YOURBRAnoos.fr> writes:
[...]
I still don't understand why book writers do continue to teach scanf()
before gets()... Kinda mystery to me...


You mean fgets() rather than gets(), right?

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #41

P: n/a
Keith Thompson wrote on 27/07/04 :
Emmanuel Delahaye <em***@YOURBRAnoos.fr> writes:
[...]
I still don't understand why book writers do continue to teach scanf()
before gets()... Kinda mystery to me...


You mean fgets() rather than gets(), right?


Yes, of course. Sorry for the typo.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html

"C is a sharp tool"

Nov 14 '05 #42

P: n/a
"Emmanuel Delahaye" <em***@YOURBRAnoos.fr> wrote in message
news:mn***********************@YOURBRAnoos.fr...

[ big snip ]

Thanks for the input. There's quite a bit of valuable info there.

newby2c
Nov 14 '05 #43

P: n/a
kal
Emmanuel Delahaye <em***@YOURBRAnoos.fr> wrote in message news:<mn***********************@YOURBRAnoos.fr>...
float us=1.00;
Why using 'float' instead of 'double' ?


IMHO, It is best to avoid both 'float' and 'double' when
dealing with money.
Bare in mind that this 'trick' is due to your C implementation.


Bear
Nov 14 '05 #44

P: n/a
kal wrote on 27/07/04 :
float us=1.00;


Why using 'float' instead of 'double' ?


IMHO, It is best to avoid both 'float' and 'double' when
dealing with money.


What do you suggest instead ? Change rates are far to be integer
expressions!
Bare in mind that this 'trick' is due to your C implementation.


Bear


Thanks. I must admit that I have learnt this expression from others
reading, and that I didn't checked it.

http://dictionary.reference.com/sear...ar%20in%20mind

Done.

Sounds that a lot of people do the same mistake.

--
Emmanuel
The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html

"C is a sharp tool"

Nov 14 '05 #45

P: n/a
kal
"K. G. Suarez" <kg****@bellsouth.net> wrote in message news:<rE*****************@bignews2.bellsouth.net>. ..
I am new to programming and my uncle gave me a copy of
"C For Dummies 2nd Edition".
It is good for dummies.
But how much will this book teach me?
Exactly as much as you learn from it.
What would be the next book to read?


Euclid's books, I to XIII.
Nov 14 '05 #46

P: n/a
On Tue, 27 Jul 2004, Emmanuel Delahaye wrote:
Any float
will be converted to a double (with a cost in terms of code space and CPU
time) before being processed (computing, function parameter etc.).


Apparently either my gcc is broken or your statement generalizes a bit
too far..

user@host$ cat foo.c
#include <stdio.h>
#include <limits.h>
int main(void) {
printf("%i\n", (int)(sizeof(1.0f+2.0f)*CHAR_BIT));
return 0;
}
user@host$ gcc foo.c -o foo && ./foo
32
Nov 14 '05 #47

P: n/a

On Tue, 27 Jul 2004, Emmanuel Delahaye wrote:

kal wrote on 27/07/04 :

[>Someone else wrote:]
[>>Someone else wrote:]
float us=1.00;

Why using 'float' instead of 'double' ?


IMHO, it is best to avoid both 'float' and 'double' when dealing with
money.


What do you suggest instead ? Change rates are far to be integer
expressions! ^^^^^^^^^


As long as we're correcting your English idioms... :)
"unlikely to be" or "far from" would be correct (but have different
meanings from each other).

Anyway, as far as I know (which isn't very far), exchange rates
are generally imprecise, like the price of gas (or petrol:) The
"exchange rate" would then be an average of several going rates,
or whatever your particular bank is charging at the moment. So
exact floating-point precision would not matter so much. But you
would presumably want to be able to do exact multiplications; if
your program claimed that 1.5 times a billion dollars was 1.4998
billion, you'd be in trouble.

My conclusion: you'd want a floating-point number to store the
actual exchange rate, but you'd need an exact type to do the
math --- either bignum, or round the rate to the nearest thousandth
of a dollar (as with U.S. gas prices ;) and do the math in fixed
point.

For a newbie programming assignment, I think all but the most
anal of us will agree that 'double' is fine. ;-)

-Arthur
Nov 14 '05 #48

P: n/a
In article <a5**************************@posting.google.com >,
kal <k_*****@yahoo.com> wrote:
"K. G. Suarez" <kg****@bellsouth.net> wrote in message
news:<rE*****************@bignews2.bellsouth.net> ...
What would be the next book to read?


Euclid's books, I to XIII.


Only if you're wanting to get into math as well as computer programming.
A better recommendation for getting into computer programming is Knuth.
dave

--
Dave Vandervies dj******@csclub.uwaterloo.caIf someone is unwilling to accept those requirements ... they may be
better off just leaving. \ --Richard Heathfield

Off you go, then. Don't forget your coat. \ roasts a troll in CLC
Nov 14 '05 #49

P: n/a
K. G. Suarez wrote:
Thank you, Bernhard. I will keep that in mind


My response is very (or at least somewhat) offtopic. I've been writing a
(compiler? compiler/compiler? language system?) in C/C++ for quite a
while. This is a personal project, not (yet, if ever) a commercial one.

Part of my plan has been to document the project externally (i.e. the
"user's manual") and internally ("how it works") as I go. Eventually,
I'm thinking of providing both documents, probably along with the
source, in book form.

Right now the program is lightyears ahead of the documentation. (The
program works, as far as I've gotten it, the documentation is woefully
inadequate.) (This is pretty much how life is in my real job as a
developer. ;-)

My question is this: Is there value in such a book? What I'm trying to
do is describe a large program (granted a somewhat esoteric one) in a
way that gives some kind of insight into the design decisions that went
into its development.

I really don't want to write "Compilers for Dummies", but maybe that's
what I'm trying to write. :-)

-Rich

P.S. You can check out the current unfinished state at
http://pennware.com/language/introduction.html

P.P.S. As a little background, I wrote compilers and assemblers,
linkers, etc. commercially for 20 years. I don't do that anymore, except
for fun.
--
Richard Pennington
Email: ri**@pennware.com
http://www.pennware.com ftp://ftp.pennware.com

Nov 14 '05 #50

60 Replies

This discussion thread is closed

Replies have been disabled for this discussion.