How to learn C ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BigRelax

    How to learn C ?

    Hello`` I am a student from chinese.
    I like C.

    --
    Message posted using http://www.talkaboutprogramming.com/group/comp.lang.c/
    More information at http://www.talkaboutprogramming.com/faq.html

  • user923005

    #2
    Re: How to learn C ?

    On Jun 24, 9:49 am, "BigRelax" <bigre...@live. cnwrote:
      Hello`` I am a student from chinese.
     I like C.
    0. It is a good idea to read the C-FAQ. It has lots of explanations
    in it of things that beginners find confusing:


    1. Read a good book on C.
    There are Chinese versions of "The C Programming Language" by Brian W.
    Kernighan and Dennis M. Ritchie:

    Chinese: C Programming Language, Prentice-Hall, ISBN 0-13-11693-7
    Chinese: The C Programming Language, China Machine Press / Prentice-
    Hall, ISBN 7-111-07589-7
    Chinese: The C Programming Language, Prentice-Hall PTR / Tsang Hai
    (Taiwan) ISBN 986-154-142-X

    2. You can download a free C compiler and practice the exercises with
    it.

    If you have questions about how the language itself works, you can ask
    them here. If you show an honest effort, people will be happy to help
    you.

    Comment

    • Nicolas Florian

      #3
      Re: How to learn C ?

      Hello BigRelax.

      As already said before you can buy some books, but you can also
      read ebooks( openbooks, no need to pay for, they're free ) or
      websites filled with content about C.

      The best way to learn C is by writing code, write as much as you can,
      you won't get far by just reading a book without writing your code.

      Comment

      • user923005

        #4
        Re: How to learn C ?

        On Jun 24, 5:40 pm, Nicolas Florian <nicolas...@gmx .dewrote:
        Hello BigRelax.
        >
        As already said before you can buy some books, but you can also
        read ebooks( openbooks, no need to pay for, they're free ) or
        websites filled with content about C.
        Often, you get what you pay for here. And a beginner is very unlikely
        to recongize correct information from utter balderdash. Most internet
        information of this nature about the C language is really badly done.
        The best way to learn C is by writing code, write as much as you can,
        you won't get far by just reading a book without writing your code.
        I agree that exercise is a good idea.

        Comment

        • Nicolas Florian

          #5
          Re: How to learn C ?

          On Jun 25, 4:59 am, user923005 <dcor...@connx. comwrote:
          On Jun 24, 5:40 pm, Nicolas Florian <nicolas...@gmx .dewrote:
          >
          Hello BigRelax.
          >
          As already said before you can buy some books, but you can also
          read ebooks( openbooks, no need to pay for, they're free ) or
          websites filled with content about C.
          >
          Often, you get what you pay for here.  And a beginner is very unlikely
          to recongize correct information from utter balderdash.  Most internet
          information of this nature about the C language is really badly done.
          Ok, I don't really know chinese books, but there is much free english
          content out there. As an example: http://www.cprogramming.com/


          Comment

          • vippstar@gmail.com

            #6
            Re: How to learn C ?

            On Jun 25, 1:35 pm, Nicolas Florian <nicolas...@gmx .dewrote:
            On Jun 25, 4:59 am, user923005 <dcor...@connx. comwrote:
            >
            On Jun 24, 5:40 pm, Nicolas Florian <nicolas...@gmx .dewrote:
            >
            Hello BigRelax.
            >
            As already said before you can buy some books, but you can also
            read ebooks( openbooks, no need to pay for, they're free ) or
            websites filled with content about C.
            >
            Often, you get what you pay for here. And a beginner is very unlikely
            to recongize correct information from utter balderdash. Most internet
            information of this nature about the C language is really badly done.
            >
            Ok, I don't really know chinese books, but there is much free english
            content out there. As an example:http://www.cprogramming.com/
            I suggest you forget everything you've read in that website, it's not
            appropriate to learn C.

            Take this for example
            <http://www.cprogrammin g.com/tutorial/c/lesson9.html>
            Note that along with C-style strings, which are arrays, there are also string literals, such as "this". In reality, both of these
            string types are merely just collections of characters sitting next to each other in memory. The only difference is that you cannot
            modify string literals, whereas you can modify arrays.
            const char array[10] = {0}; /* can you modify *this* array? */
            What are 'string types'?
            What are 'C-style strings'?
            If they are talking about strings and string literals, then no, they
            are not merely collections of characters.
            Some things that might look like strings are not strings; in particular, a character inclosed in single quotes, like this, 'a', is not
            a string. It's a single character, which can be assigned to a specific location in a string, but which cannot be treated as a string.
            (Remember how arrays act like pointers when passed into functions? Characters don't, so if you pass a single character into a
            function, it won't work; the function is expecting a char*, not a char.)
            What they don't mention which I'd consider more important is that "a
            \0a" is not a string.
            It's 'c-character-sequence', not 'character'. 'a' has int type, not
            char type. Arrays do not 'act' as pointers when they are passed into
            functions.

            Comment

            • pete

              #7
              Re: How to learn C ?

              vippstar@gmail. com wrote:
              On Jun 25, 1:35 pm, Nicolas Florian <nicolas...@gmx .dewrote:
              >On Jun 25, 4:59 am, user923005 <dcor...@connx. comwrote:
              >>
              >>On Jun 24, 5:40 pm, Nicolas Florian <nicolas...@gmx .dewrote:
              >>>Hello BigRelax.
              >>>As already said before you can buy some books, but you can also
              >>>read ebooks( openbooks, no need to pay for, they're free ) or
              >>>websites filled with content about C.
              >>Often, you get what you pay for here. And a beginner is very unlikely
              >>to recongize correct information from utter balderdash. Most internet
              >>information of this nature about the C language is really badly done.
              >Ok, I don't really know chinese books, but there is much free english
              >content out there. As an example:http://www.cprogramming.com/
              >
              I suggest you forget everything you've read in that website, it's not
              appropriate to learn C.
              >
              Take this for example
              <http://www.cprogrammin g.com/tutorial/c/lesson9.html>
              >Note that along with C-style strings, which are arrays, there are also string literals, such as "this". In reality, both of these
              >string types are merely just collections of characters sitting next to each other in memory. The only difference is that you cannot
              >modify string literals, whereas you can modify arrays.
              const char array[10] = {0}; /* can you modify *this* array? */
              What are 'string types'?
              What are 'C-style strings'?
              If they are talking about strings and string literals, then no, they
              are not merely collections of characters.
              >Some things that might look like strings are not strings; in particular, a character inclosed in single quotes, like this, 'a', is not
              >a string. It's a single character, which can be assigned to a specific location in a string, but which cannot be treated as a string.
              >(Remember how arrays act like pointers when passed into functions? Characters don't, so if you pass a single character into a
              >function, it won't work; the function is expecting a char*, not a char.)
              What they don't mention which I'd consider more important is that "a
              \0a" is not a string.
              It's 'c-character-sequence', not 'character'. 'a' has int type, not
              char type. Arrays do not 'act' as pointers when they are passed into
              functions.
              A number of strings may exist within an array.

              The object referred to by a string literal, *is* an array.

              --
              pete

              Comment

              • pete

                #8
                Re: How to learn C ?

                vippstar@gmail. com wrote:
                On Jun 25, 1:35 pm, Nicolas Florian <nicolas...@gmx .dewrote:
                >Ok, I don't really know chinese books, but there is much free english
                >content out there. As an example:http://www.cprogramming.com/
                >
                I suggest you forget everything you've read in that website, it's not
                appropriate to learn C.
                >
                Take this for example
                <http://www.cprogrammin g.com/tutorial/c/lesson9.html>
                It's the proverbial c/c++ language.

                "Keep in mind that to use delete you must put []
                between delete and arry to tell it to free
                all 256 bytes of memory allocated."

                Also, I am against "strncpy is a safer strcpy".

                --
                pete

                Comment

                • CBFalconer

                  #9
                  Re: How to learn C ?

                  pete wrote:
                  vippstar@gmail. com wrote:
                  >>
                  >Take this for example
                  ><http://www.cprogrammin g.com/tutorial/c/lesson9.html>
                  >
                  It's the proverbial c/c++ language.
                  >
                  "Keep in mind that to use delete you must put []
                  between delete and arry to tell it to free
                  all 256 bytes of memory allocated."
                  >
                  Also, I am against "strncpy is a safer strcpy".
                  Look up strlcpy and strlcat. You can find them on my page.

                  --
                  [mail]: Chuck F (cbfalconer at maineline dot net)
                  [page]: <http://cbfalconer.home .att.net>
                  Try the download section.


                  ** Posted from http://www.teranews.com **

                  Comment

                  • Richard Heathfield

                    #10
                    Re: How to learn C ?

                    CBFalconer said:
                    pete wrote:
                    >vippstar@gmail. com wrote:
                    >>>
                    >>Take this for example
                    >><http://www.cprogrammin g.com/tutorial/c/lesson9.html>
                    >>
                    >It's the proverbial c/c++ language.
                    >>
                    >"Keep in mind that to use delete you must put []
                    > between delete and arry to tell it to free
                    > all 256 bytes of memory allocated."
                    >>
                    >Also, I am against "strncpy is a safer strcpy".
                    >
                    Look up strlcpy and strlcat.
                    I did. They don't exist.
                    You can find them on my page.
                    Your page is not normative.

                    --
                    Richard Heathfield <http://www.cpax.org.uk >
                    Email: -http://www. +rjh@
                    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
                    "Usenet is a strange place" - dmr 29 July 1999

                    Comment

                    • Keith Thompson

                      #11
                      Re: How to learn C ?

                      Richard Heathfield <rjh@see.sig.in validwrites:
                      CBFalconer said:
                      pete wrote:
                      vippstar@gmail. com wrote:
                      >>
                      >Take this for example
                      ><http://www.cprogrammin g.com/tutorial/c/lesson9.html>
                      >
                      It's the proverbial c/c++ language.
                      >
                      "Keep in mind that to use delete you must put []
                      between delete and arry to tell it to free
                      all 256 bytes of memory allocated."
                      >
                      Also, I am against "strncpy is a safer strcpy".
                      Look up strlcpy and strlcat.
                      >
                      I did. They don't exist.
                      By "They don't exist", I presume you mean "They're non-standard". The
                      do in fact exist.
                      You can find them on my page.
                      >
                      Your page is not normative.
                      If I recall correctly, his page has standard C implementations of the
                      (admittedly non-standard) strlcpy and strlcat functions.

                      --
                      Keith Thompson (The_Other_Keit h) 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"

                      Comment

                      • Richard Heathfield

                        #12
                        Re: How to learn C ?

                        Keith Thompson said:
                        Richard Heathfield <rjh@see.sig.in validwrites:
                        >CBFalconer said:
                        <snip>
                        Look up strlcpy and strlcat.
                        >>
                        >I did. They don't exist.
                        >
                        By "They don't exist", I presume you mean "They're non-standard".
                        I was answering in a C context, yes.
                        The do in fact exist.
                        And if they don't, we can always create them. For example:

                        int strlcpy(char *s, char *t)
                        {
                        while(*t++) *s++ = *t++;
                        *s = '\0';
                        }

                        If you agree that this is a legal extension for an implementation to
                        provide, please explain why it is a 'safer strcpy', as Chuck seemed to be
                        implying. (It is, of course, not a strcpy at all.) And if you disagree
                        that this is a legal extension for an implementation, please explain why,
                        with reference to the Standard.
                        You can find them on my page.
                        >>
                        >Your page is not normative.
                        >
                        If I recall correctly, his page has standard C implementations of the
                        (admittedly non-standard) strlcpy and strlcat functions.
                        That's a contradiction.

                        --
                        Richard Heathfield <http://www.cpax.org.uk >
                        Email: -http://www. +rjh@
                        Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
                        "Usenet is a strange place" - dmr 29 July 1999

                        Comment

                        • CBFalconer

                          #13
                          Re: How to learn C ?

                          Richard Heathfield wrote:
                          CBFalconer said:
                          >pete wrote:
                          >>
                          .... snip ...
                          >>
                          >>Also, I am against "strncpy is a safer strcpy".
                          >>
                          >Look up strlcpy and strlcat.
                          >
                          I did. They don't exist.
                          >
                          >You can find them on my page.
                          >
                          Your page is not normative.
                          What a foolish waste. I am sure you are aware that these functions
                          were originated by the openBSD project, and have been generally
                          well received. No, they are not standard, which is why I inserted
                          the reference to my page, where source and docs can be found. They
                          include considerations about naming. Your silly comment is
                          designed purely to obstruct.

                          --
                          [mail]: Chuck F (cbfalconer at maineline dot net)
                          [page]: <http://cbfalconer.home .att.net>
                          Try the download section.

                          ** Posted from http://www.teranews.com **

                          Comment

                          • Richard Bos

                            #14
                            Re: How to learn C ?

                            CBFalconer <cbfalconer@yah oo.comwrote:
                            Look up strspam and strspammy. You can find them on my page.
                            Yes, jacob, we know.

                            Richard

                            Comment

                            • Richard Heathfield

                              #15
                              Re: How to learn C ?

                              CBFalconer said:
                              Richard Heathfield wrote:
                              >CBFalconer said:
                              >>pete wrote:
                              >>>
                              ... snip ...
                              >>>
                              >>>Also, I am against "strncpy is a safer strcpy".
                              >>>
                              >>Look up strlcpy and strlcat.
                              >>
                              >I did. They don't exist.
                              >>
                              >>You can find them on my page.
                              >>
                              >Your page is not normative.
                              >
                              What a foolish waste.
                              Either extensions are topical here or they aren't. Which do you think it
                              should be?
                              I am sure you are aware that these functions
                              were originated by the openBSD project, and have been generally
                              well received.
                              So what? If you think strlcpy and strlcat are topical here, please explain
                              whether you think strdup, clrscr, getch, kbhit, ioctl, getsockname,
                              PhysBase, LogBase, GetRez, EXEC CICS, EXEC SQL, CreateWindow,
                              SetWindowText, and WritePrivatePro fileString are topical too. If so, why?
                              If not, why not?
                              No, they are not standard, which is why I inserted
                              the reference to my page, where source and docs can be found.
                              So is it your opinion that we can discuss any extension we like in
                              comp.lang.c, provided we give a reference URL?
                              They
                              include considerations about naming. Your silly comment is
                              designed purely to obstruct.
                              I didn't make a silly comment, and the comment I did make was designed
                              purely to educate.

                              --
                              Richard Heathfield <http://www.cpax.org.uk >
                              Email: -http://www. +rjh@
                              Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
                              "Usenet is a strange place" - dmr 29 July 1999

                              Comment

                              Working...