Learning C

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mfasoccer@gmail.com

    Learning C

    I am sorry if this is an inappropriate place to put this post, if so
    please delete it.

    I am wondering about a few things. Do you guys recommend learning C as
    a second language, as someone who already knows java very well. And
    what is the best way to learn C, books, tutorials, or what?

    Thanks, any response would be great.

  • Micah Cowan

    #2
    Re: Learning C

    "mfasoccer@gmai l.com" <mfasoccer@gmai l.com> writes:
    [color=blue]
    > I am sorry if this is an inappropriate place to put this post, if so
    > please delete it.[/color]

    Well, this is an entirely appropriate place for this post, but if it
    had not been, deleting the post would be impossible (once you post to
    USENET, it stays there, for the most part. Even "cancelling " a post
    you made will may affect some but not all servers).
    [color=blue]
    > I am wondering about a few things. Do you guys recommend learning C as
    > a second language, as someone who already knows java very well. And
    > what is the best way to learn C, books, tutorials, or what?
    >
    > Thanks, any response would be great.[/color]

    I'd be willing to bet that most of the folks on this group began
    learning C with a book. Unfortunately, there is a very high ratio of
    crappy C books to useful C books. I strongly recommend you buy a copy
    of K&R C ("The C Programming Language", by Kernighan and Ritchie, 2nd
    edition), written by the actual inventors of C. The C language has
    actually changed since then, but the language described there is still
    the most portable version of the language, and that book is the most
    widely recognized

    When you've worked through that, you should probably buy a copy of "C:
    A Reference Manual" by Harbison & Steele.

    See also http://c-faq.com/resources/books.html, which gives a few
    pointers on finding good books on C.

    Participating in this newsgroup, or on alt.comp.lang.l earn.c-c++, can
    also be /very/ beneficial, /provided/:

    1. You thoroughly familiarize yourself with the
    rules-of-conduct/posting for the group. This can be accomplished
    by reading about 2 weeks' worth of posts before posting
    yourself. See what kinds of posts get good responses, and which
    get poor ones.

    2. You have the humility and good grace to receive constructive
    criticisms, both of your code and of any errant behavior on the
    group.

    HTH,
    Micah

    Comment

    • mfasoccer@gmail.com

      #3
      Re: Learning C

      Thanks alot for the response, a few minutes after posting I searched
      this group and found hundreds of other threads about the same topic. I
      apoligize as well for double posting, that was a mistake even though
      I'm sure it must look like I tryed to bump my thread.

      I wanted as well, to bring forth another concern that I have with
      programming in general. Many people say that ACTUALLY PROGRAMMING
      real-world programs is the best way to get better. That theory makes
      sense, but when I sit down to write a program in java, I often realize
      that I have mastered the sytnax and searching and sorting algorithms,
      yet I cannot apply this to a real-world program. Are there any books
      for C or websites that explain the analytical thinking or other tactics
      involved in practical uses of C?

      Comment

      • Richard Heathfield

        #4
        Re: Learning C

        mfasoccer@gmail .com said:
        [color=blue]
        > Are there any books
        > for C or websites that explain the analytical thinking or other tactics
        > involved in practical uses of C?[/color]

        Your best starting point is the book Micah mentioned. It has a bunch of
        exercises scattered throughout each chapter. Do them. It's astoundingly
        good training for practical C use. As for analytical thinking, you could do
        worse than stick around in comp.lang.c - some of the regular contributors
        are fine exponents of the art. (See also Knuth's "The Art of Computer
        Programming" - all three volumes - and don't be put off by the mathemagical
        flavour.)

        --
        Richard Heathfield
        "Usenet is a strange place" - dmr 29/7/1999

        email: rjh at above domain (but drop the www, obviously)

        Comment

        • mb1471

          #5
          Re: Learning C

          I hear it is very important to use a linux machine for c programming,
          is this just a common myth or is there any truth there. I have been
          considering switching to linux for this reason, but I'm not sure if
          it's worth it..?

          Comment

          • CBFalconer

            #6
            Re: Learning C

            "mfasoccer@gmai l.com" wrote:[color=blue]
            >
            > Thanks alot for the response, a few minutes after posting I searched
            > this group and found hundreds of other threads about the same topic. I
            > apoligize as well for double posting, that was a mistake even though
            > I'm sure it must look like I tryed to bump my thread.
            >
            > I wanted as well, to bring forth another concern that I have with
            > programming in general. Many people say that ACTUALLY PROGRAMMING
            > real-world programs is the best way to get better. That theory makes
            > sense, but when I sit down to write a program in java, I often realize
            > that I have mastered the sytnax and searching and sorting algorithms,
            > yet I cannot apply this to a real-world program. Are there any books
            > for C or websites that explain the analytical thinking or other tactics
            > involved in practical uses of C?[/color]

            Our own Richard Heathfield has published such a book in "C
            Unleashed". So have Kernighan & Pike "The Practice of
            Programming". One of the best is Wirths "Algorithms + Data
            Structures = Programs".

            Get in the immediate habit of including adequate context in any
            replies. Don't let the fact that you are posting through that
            abortion of a usenet interface offered by google faze you. Read my
            sig. below, and read the referenced URLs. Google IS NOT usenet.

            All usenet articles need to stand by themselves. There is no
            guarantee that any particular other article has ever reached, or
            ever will reach, the reader. Even if it has, it may have been
            deleted, or just be awkward to view. So quote adequately, and snip
            quoted material that is irrelevant to your reply. Do not top-post,
            your answer belongs after (or intermixed with) the material to
            which you reply.

            --
            "If you want to post a followup via groups.google.c om, don't use
            the broken "Reply" link at the bottom of the article. Click on
            "show options" at the top of the article, then click on the
            "Reply" at the bottom of the article headers." - Keith Thompson
            More details at: <http://cfaj.freeshell. org/google/>
            Also see <http://www.safalra.com/special/googlegroupsrep ly/>

            Comment

            • Richard Heathfield

              #7
              Re: Learning C

              mb1471 said:
              [color=blue]
              > I hear it is very important to use a linux machine for c programming,
              > is this just a common myth or is there any truth there.[/color]

              It's a common myth - and like many myths, it has a huge amount of truth
              behind it.

              C is a portable language. Any box you can find a C compiler (or
              cross-compiler) for, you can use for C programming. And if you write your
              code carefully, very often the only thing you have to do to get your
              program working on a different system is to recompile on the new system.
              So, for example, you write your Widgetalyser on a Mac, get it working, copy
              it over to a mainframe, recompile, and hey, presto! It works on the
              mainframe too. And, one recompile later, it works on Linux too. And maybe
              even on your mobile phone or microwave oven. (Er - maybe.)
              [color=blue]
              > I have been
              > considering switching to linux for this reason, but I'm not sure if
              > it's worth it..?[/color]

              Oh, it's worth it all right. But perhaps you should put in a couple of years
              on a Windows box first, just so that you'll be *really grateful* when you
              change over. ;-)

              Seriously, I don't like Windows (having used it for many years), I do like
              Linux (having used it for a few years), but C doesn't care. You can get
              good C compilers for Windows easily enough, legally for free in many cases.
              The only thing to watch - er, one of a few things to watch is that you need
              to be very firm with your typical Windows development environment. Be sure
              to save your files with a .c extension, not a .cpp extension. Typical
              Windows compilers will see a .cpp extension as an invitation to use C++
              rules instead of C rules when compiling - with, as the saying goes, the
              usual hilarious results.

              --
              Richard Heathfield
              "Usenet is a strange place" - dmr 29/7/1999

              email: rjh at above domain (but drop the www, obviously)

              Comment

              • Nick Keighley

                #8
                Re: Learning C

                Richard G. Riley wrote:[color=blue]
                > "mfasoccer@gmai l.com"posted the following on 2006-03-10:[/color]
                [color=blue][color=green]
                > > Thanks alot for the response, a few minutes after posting I searched
                > > this group and found hundreds of other threads about the same topic. I
                > > apoligize as well for double posting, that was a mistake even though
                > > I'm sure it must look like I tryed to bump my thread.
                > >
                > > I wanted as well, to bring forth another concern that I have with
                > > programming in general. Many people say that ACTUALLY PROGRAMMING
                > > real-world programs is the best way to get better. That theory makes
                > > sense, but when I sit down to write a program in java, I often realize
                > > that I have mastered the sytnax and searching and sorting algorithms,
                > > yet I cannot apply this to a real-world program. Are there any books
                > > for C or websites that explain the analytical thinking or other tactics
                > > involved in practical uses of C?[/color]
                >
                > One great way is to analyse existing systems. You mentioned moving to
                > Linux : this is a great idea because you can compile and step through
                > existing apps with the debugger.[/color]

                could we keep the platform bigotry down to a dull roar? Windows has
                perfectly good debuggers available as well. So if you really want to
                (I've never had the urge) you can "step through existing apps".

                I've developed serious applications on both Linux and Windows. They are

                both perfectly adequate. It is completly possible to develop
                applications
                on windows. For heavens sake Windows was *written* in C!

                <snip>


                --
                Nick Keighley

                Comment

                • Jordan Abel

                  #9
                  Re: Learning C

                  On 2006-03-10, Richard Heathfield <invalid@invali d.invalid> wrote:[color=blue]
                  > mb1471 said:
                  >[color=green]
                  >> I hear it is very important to use a linux machine for c programming,
                  >> is this just a common myth or is there any truth there.[/color]
                  >
                  > It's a common myth - and like many myths, it has a huge amount of truth
                  > behind it.[/color]

                  You forgot to mention what that truth is.

                  Linux, as a "unix-like" system, has a great deal of cultural heritage
                  that is a good "fit" for C, as C was originally developed for UNIX. This
                  can be useful [it's probably the type of system on which the implement-
                  ation of the standard functions is going to be most straightforward *],
                  but also dangerous [a lot of things that aren't really defined by the
                  standard are going to happen to work the way you'll assume they should]

                  *Note I wouldn't actually recommend trying to _read_ the glibc source,
                  though. If you seriously plan on doing that, get a unixy OS other than
                  linux. Say, FreeBSD. or Mac OSX. or SCO [well, that doesn't come with
                  source code, but i'm sure its source code is still more readable than
                  glibc even so]. really, anything.

                  Comment

                  • Nick Keighley

                    #10
                    Re: Learning C


                    Richard G. Riley wrote:[color=blue]
                    > "Nick"poste d the following on 2006-03-10:
                    >[color=green]
                    > > Richard G. Riley wrote:[color=darkred]
                    > >> "mfasoccer@gmai l.com"posted the following on 2006-03-10:[/color]
                    > >[color=darkred]
                    > >> > Thanks alot for the response, a few minutes after posting I searched
                    > >> > this group and found hundreds of other threads about the same topic. I
                    > >> > apoligize as well for double posting, that was a mistake even though
                    > >> > I'm sure it must look like I tryed to bump my thread.
                    > >> >
                    > >> > I wanted as well, to bring forth another concern that I have with
                    > >> > programming in general. Many people say that ACTUALLY PROGRAMMING
                    > >> > real-world programs is the best way to get better. That theory makes
                    > >> > sense, but when I sit down to write a program in java, I often realize
                    > >> > that I have mastered the sytnax and searching and sorting algorithms,
                    > >> > yet I cannot apply this to a real-world program. Are there any books
                    > >> > for C or websites that explain the analytical thinking or other tactics
                    > >> > involved in practical uses of C?
                    > >>
                    > >> One great way is to analyse existing systems. You mentioned moving to
                    > >> Linux : this is a great idea because you can compile and step through
                    > >> existing apps with the debugger.[/color]
                    > >
                    > > could we keep the platform bigotry down to a dull roar? Windows has
                    > > perfectly good debuggers available as well. So if you really want to
                    > > (I've never had the urge) you can "step through existing apps".[/color]
                    >
                    > No you cant. Firstly, I use multiple OSs : windows, OS/2 and Linux so
                    > get away with your attempt to suggest this is an OS war bigotry.
                    >
                    > Secondly, what system apps are you aware of in windows which come with
                    > the C source code? Most are in C++ anyway. Most Gnome/Linux system is
                    > in C. The OP was asking about C.[/color]

                    I thought you were implying Linux was better because the *debugger* was

                    better. I've never stepped through an existing application (that wasn't
                    broken)
                    with a debugger. If you say it's a good way to learn C, who am I to
                    argue.

                    But it *still* sounds bizzare to me

                    <snip>


                    --
                    Nick Keighley

                    Comment

                    • Chris Dollin

                      #11
                      Re: Learning C

                      Richard G. Riley wrote:
                      [color=blue]
                      > "Nick"poste d the following on 2006-03-10:[/color]
                      [color=blue][color=green]
                      >> I thought you were implying Linux was better because the *debugger* was[/color][/color]
                      [color=blue]
                      >
                      > There is no "the debugger" : although gdb is prevalent in Linux -
                      > albeit with several front ends.
                      >[color=green]
                      >> better. I've never stepped through an existing application (that wasn't
                      >> broken)
                      >> with a debugger. If you say it's a good way to learn C, who am I to
                      >> argue.[/color]
                      >
                      > I said its one way to get used to the structure and flow of
                      > applications which is what he wants. Also, I do think a debugger can
                      > give real insight into how C works in the real world : results of
                      > operators there for you to see with no overhead of printfs which some
                      > favor.[/color]

                      The printf's are portable. The printf's work without manual intervention.
                      The printfs work without having to understand an additional tool.
                      [color=blue][color=green]
                      >> But it *still* sounds bizzare to me
                      >>[/color]
                      >
                      > What does? Are we talking about the same thing? Do you doubt that
                      > watching other, well written apps work is beneficial to a newbie? It
                      > seems fairly clear to me that it can only help. Its how the entire
                      > Open SW system works : people learning by doing and picking up on
                      > other peoples work.[/color]

                      You've conflated "learning by doing and picking up on> other peoples work"
                      with "watching ... apps work" and that with stepping through an application
                      using a debugger. I think that's misleading.

                      --
                      Chris "sparqling" Dollin
                      "Who do you serve, and who do you trust?"

                      Comment

                      • Vladimir S. Oka

                        #12
                        Re: Learning C


                        Chris Dollin wrote:[color=blue]
                        > Richard G. Riley wrote:[color=green]
                        > > "Nick"poste d the following on 2006-03-10:[color=darkred]
                        > >> I thought you were implying Linux was better because the *debugger* was[/color]
                        > >
                        > > There is no "the debugger" : although gdb is prevalent in Linux -
                        > > albeit with several front ends.[/color][/color]

                        < snip >
                        [color=blue][color=green]
                        > > What does? Are we talking about the same thing? Do you doubt that
                        > > watching other, well written apps work is beneficial to a newbie? It
                        > > seems fairly clear to me that it can only help. Its how the entire
                        > > Open SW system works : people learning by doing and picking up on
                        > > other peoples work.[/color]
                        >
                        > You've conflated "learning by doing and picking up on> other peoples work"
                        > with "watching ... apps work" and that with stepping through an application
                        > using a debugger. I think that's misleading.[/color]

                        You've been trolled!

                        Especially in the light of the reply by the same person I couldn't
                        avoid seeing, as I'm forced to use Google from the office.

                        --
                        BR, Vladimir

                        Comment

                        • Mike Wahler

                          #13
                          Re: Learning C


                          "Nick Keighley" <nick_keighley_ nospam@hotmail. com> wrote in message
                          news:1141991984 .277636.238370@ j52g2000cwj.goo glegroups.com.. .[color=blue]
                          >
                          > Richard G. Riley wrote:[color=green]
                          >> "Nick"poste d the following on 2006-03-10:
                          >>[color=darkred]
                          >> > Richard G. Riley wrote:
                          >> >> "mfasoccer@gmai l.com"posted the following on 2006-03-10:
                          >> >
                          >> >> > Thanks alot for the response, a few minutes after posting I searched
                          >> >> > this group and found hundreds of other threads about the same topic.
                          >> >> > I
                          >> >> > apoligize as well for double posting, that was a mistake even though
                          >> >> > I'm sure it must look like I tryed to bump my thread.
                          >> >> >
                          >> >> > I wanted as well, to bring forth another concern that I have with
                          >> >> > programming in general. Many people say that ACTUALLY PROGRAMMING
                          >> >> > real-world programs is the best way to get better. That theory makes
                          >> >> > sense, but when I sit down to write a program in java, I often
                          >> >> > realize
                          >> >> > that I have mastered the sytnax and searching and sorting
                          >> >> > algorithms,
                          >> >> > yet I cannot apply this to a real-world program. Are there any books
                          >> >> > for C or websites that explain the analytical thinking or other
                          >> >> > tactics
                          >> >> > involved in practical uses of C?
                          >> >>
                          >> >> One great way is to analyse existing systems. You mentioned moving to
                          >> >> Linux : this is a great idea because you can compile and step through
                          >> >> existing apps with the debugger.
                          >> >
                          >> > could we keep the platform bigotry down to a dull roar? Windows has
                          >> > perfectly good debuggers available as well. So if you really want to
                          >> > (I've never had the urge) you can "step through existing apps".[/color]
                          >>
                          >> No you cant. Firstly, I use multiple OSs : windows, OS/2 and Linux so
                          >> get away with your attempt to suggest this is an OS war bigotry.
                          >>
                          >> Secondly, what system apps are you aware of in windows which come with
                          >> the C source code? Most are in C++ anyway. Most Gnome/Linux system is
                          >> in C. The OP was asking about C.[/color]
                          >
                          > I thought you were implying Linux was better because the *debugger* was
                          >
                          > better. I've never stepped through an existing application (that wasn't
                          > broken)
                          > with a debugger. If you say it's a good way to learn C, who am I to
                          > argue.
                          >
                          > But it *still* sounds bizzare to me[/color]

                          My $.02:

                          I learned C on MS-DOS systems. I found using a debugger
                          (even with 'working' code) to be an *extremely* good aid
                          in understanding the language and how it was implemented
                          on that system. E.g. when creating a new function, before
                          integrating it with the main program, I'd run it in a
                          'test harness' under a debugger, and more often than
                          not, I was able to find and fix bugs before they got
                          into the main application.

                          -Mike

                          [color=blue]
                          >
                          > <snip>
                          >
                          >
                          > --
                          > Nick Keighley
                          >[/color]


                          Comment

                          • Default User

                            #14
                            Re: Learning C

                            Mike Wahler wrote:

                            [color=blue]
                            > I learned C on MS-DOS systems. I found using a debugger
                            > (even with 'working' code) to be an extremely good aid
                            > in understanding the language and how it was implemented
                            > on that system. E.g. when creating a new function, before
                            > integrating it with the main program, I'd run it in a
                            > 'test harness' under a debugger, and more often than
                            > not, I was able to find and fix bugs before they got
                            > into the main application.[/color]


                            Sure, but that's not what was claimed. The original statement said
                            "existing programs", so not the one under development. I don't think
                            tracing someone else's code is likely to be much of a learning tool.

                            Personally I've never found that even reading other code was useful for
                            learning basic programming. It teaches one how to read code, which is a
                            useful skill in and of itself, but not how to program. Only writing
                            code teaches you that.

                            An experienced programmer may well look at existing code for tips on
                            how to approach a problem, but that's another thing altogether.



                            --
                            Please quote enough of the previous message for context. To do so from
                            Google, click "show options" and use the Reply shown in the expanded
                            header.

                            Comment

                            • Mike Wahler

                              #15
                              Re: Learning C


                              "Default User" <defaultuserbr@ yahoo.com> wrote in message
                              news:47ehipFf5r 27U1@individual .net...[color=blue]
                              > Mike Wahler wrote:
                              >
                              >[color=green]
                              >> I learned C on MS-DOS systems. I found using a debugger
                              >> (even with 'working' code) to be an extremely good aid
                              >> in understanding the language and how it was implemented
                              >> on that system. E.g. when creating a new function, before
                              >> integrating it with the main program, I'd run it in a
                              >> 'test harness' under a debugger, and more often than
                              >> not, I was able to find and fix bugs before they got
                              >> into the main application.[/color]
                              >
                              >
                              > Sure, but that's not what was claimed.[/color]

                              OK, perhaps I misunderstood. I was simply stating
                              that I found a debugger to be useful while learning
                              the language.

                              [color=blue]
                              > The original statement said
                              > "existing programs", so not the one under development. I don't think
                              > tracing someone else's code is likely to be much of a learning tool.[/color]

                              I think it can help (provided it's 'decent' code).
                              [color=blue]
                              > Personally I've never found that even reading other code was useful for
                              > learning basic programming.[/color]

                              I have, especially textbook examples. I suppose this is
                              just a case of YMMV. :-)
                              [color=blue]
                              > It teaches one how to read code, which is a
                              > useful skill in and of itself, but not how to program. Only writing
                              > code teaches you that.[/color]

                              I also think writing code is the probably the most useful way to learn.
                              My remarks about a debugger were in that context. "Write it, then
                              watch it."

                              [color=blue]
                              > An experienced programmer may well look at existing code for tips on
                              > how to approach a problem, but that's another thing altogether.[/color]

                              -Mike


                              Comment

                              Working...