Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #2856

Re: Just starting out in C

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Just starting out in C
Date 2011-04-24 22:28 -0700
Organization None to speak of
Message-ID <ln4o5m293q.fsf@nuthaus.mib.org> (permalink)
References <1c7cbaf6-ca06-4cd0-a287-48b46e0f2540@r19g2000prm.googlegroups.com>

Show all headers | View raw


Robert Miles <robertmilesxyz@gmail.com> writes:
> I'm just starting out learning C, but using Windows Vista instead of a
> more C-oriented operating system.
>
> So far I've found this on-line tutorial, which looks like a good brief
> introduction:
>
> http://www.physics.drexel.edu/courses/Comp_Phys/General/C_basics/c_tutorial.html
[...]

I just took a very quick look at that tutorial.  I can't tell yet
whether the tutorial as a whole is any good, but the things it gets
wrong in the first few paragraphs do not make me optimistic.

Some things it gets wrong:

ANSI issued the first C standard in 1989, not 1988.  K&R's 1998 book
(see below) was based on the ANSI standard as it was being developed.

"#include < stdio.h>" is wrong; there's no space after the '<'.
That's probably an HTML markup issue.  You'll note that if you
copy and paste one of the examples into a C source file, it won't
compile until you delete the extra space.

"void main()" is wrong, and I'd like to know where the &*^&
the authors got the idea that it's correct; K&R2 certainly
never suggests it.  The correct declaration is "int main(void)";
"int main()" is probably acceptable.  Many compilers will accept
"void main()" without complaint, but it's particularly important
in C to understand that just because something appears to work,
that doesn't mean it's correct.

printf("\nHello World\n") prints an extra blank line before the output.
Harmless, I suppose, but why?

"This creates an executable file a.out, which is then executed simply by
typing its name."  No, it doesn't, unless you have '.' in your $PATH,
which you shouldn't.  Type "./a.out".  (That's a Unix issue, not a C
issue.)

Skipping to the end, you should be aware that the dialog box routines in
the final example are not standard; they appear to be something created
for the course.

And so on.  The fact that the authors recommend K&R2 is a point in their
favor.  Please consider skipping the tutorial and reading K&R2
(Kernighan & Ritchie, "The C Programming Language", 2nd edition, 1988).

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Just starting out in C Robert Miles <robertmilesxyz@gmail.com> - 2011-04-24 17:00 -0700
  Re: Just starting out in C Geoff <geoff@invalid.invalid> - 2011-04-24 17:16 -0700
    Re: Just starting out in C Keith Thompson <kst-u@mib.org> - 2011-04-24 22:06 -0700
  Re: Just starting out in C Mickey Mouse <fake@email.com> - 2011-04-24 19:54 -0700
  Re: Just starting out in C Keith Thompson <kst-u@mib.org> - 2011-04-24 22:08 -0700
  Re: Just starting out in C Keith Thompson <kst-u@mib.org> - 2011-04-24 22:28 -0700
    Re: Just starting out in C BruceS <bruces42@hotmail.com> - 2011-04-25 06:34 -0700
    Re: Just starting out in C pete <pfiland@mindspring.com> - 2011-04-25 12:29 -0400
    Re: Just starting out in C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-04-27 14:48 +0000
    Re: Just starting out in C John Bode <jfbode1029@gmail.com> - 2011-04-28 09:55 -0700
      Re: Just starting out in C Keith Thompson <kst-u@mib.org> - 2011-04-28 11:51 -0700

csiph-web