Thread: C tutorial Onsite.

  1. #1
    Registered User
    Join Date
    Jul 2007
    Location
    SK, Canada
    Posts
    14

    C tutorial Onsite.

    I'm new, and can't find my answer around the site, so I was forced to ask.

    http://www.cprogramming.com/tutorial.html the Basic C tutorial is not fully ported.
    I want to learn C (and then move onto C++) but I don't want to start with a half-finished tutorial.

    Is there any full tutorials for C that you would recommend, I don't really want to learn C++ until I know and am comfortable with C but I can't find where to start.

    I've come across lots of C tutorials but I always seem to run into problems with MinGW and Dev C++. Sometimes there code is not compatible with GCC (Linux) and MinGW or Dev C++(I don't know much about standards).

    I really need help where to start, I've learned HTML and CSS in the past, and am pretty comfortable with those languages so I'm not new to this whole coding thing, I would like to learn how to code programs.

    Have I missed anything obvious on this site that would help me.

    I've been lead to this tutorial before http://www.nongnu.org/c-prog-book/online/index.html

    but http://www.nongnu.org/c-prog-book/online/x562.html compiles fine in windows but won't execute correctly.

    Thanks.
    Last edited by tihoc4n; 07-21-2007 at 12:25 PM.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    Just go ahead and read through the C tutorials. A lot of the C++ ones are specific to C++. For instance, classes, templates, and subsequently OOP concepts like Inheritance and Polymorphism aren't really applicable to C (although OOP can be "faked" in C, and those concepts might apply in some way).

    The tutorials on this website are probably very close to the C standard(s). I would also recommend reading this: http://www.howstuffworks.com/c.htm

    Be aware, however, that a lot of information from that last site is not correct. The best part of that site is the diagrams. Consider the code examples there to be proof of concept, and not necessarily corrrect. Things like declaring main() to return void is wrong, and not valid C code. Many times, compilers will let you get away with all kinds of things. If you utilize these "features", other compilers might not allow you to do the same, and you'll get stuck writing code that only works on one compiler.

    Seriously consider compiling your code with warning levels turned up.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by tihoc4n View Post
    but http://www.nongnu.org/c-prog-book/online/x562.html compiles fine in windows but won't execute correctly.
    there is a missing semicolon and an extra one at the end of the while condition.

  4. #4
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    There is no need to learn C then C++ - you can just jump straight to the latter, and I would suggest getting a book if you're serious.

  5. #5
    Registered User
    Join Date
    Jul 2007
    Location
    SK, Canada
    Posts
    14
    Quote Originally Posted by robwhit View Post
    there is a missing semicolon and an extra one at the end of the while condition.
    Thanks, I've noticed and even with that corrected it has execution problems.

    Quote Originally Posted by zacs7 View Post
    There is no need to learn C then C++ - you can just jump straight to the latter, and I would suggest getting a book if you're serious.
    Thanks for the advice, I've noticed the sticky thread, I'll take a look in there.

    I'll take a look into the online ones first and see how that goes.

    Thanks to you all.

  6. #6
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by tihoc4n View Post
    Thanks, I've noticed and even with that corrected it has execution problems.
    works for me. what sort of problems are you having?

  7. #7
    Registered User
    Join Date
    Jul 2007
    Location
    SK, Canada
    Posts
    14
    Quote Originally Posted by robwhit View Post
    works for me. what sort of problems are you having?
    When I type in the first guess, the program hangs. On Windows, with MinGW.
    Edit: forget that, I understand what is meant by the extra one at the end of the while condition, it works fine. Sorry. Thinking about it, it makes allot of sense to why that occurred, I guess bugs are a bigger learning curve than I thought.

    And can someone tell me why a new line is preferred at the end of any C code?
    Last edited by tihoc4n; 07-21-2007 at 07:57 PM.

  8. #8
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by tihoc4n
    And can someone tell me why a new line is preferred at the end of any C code?
    Because it's easier to read and flows well (readability wise). It also usually means the line will fit on the screen and you don't have to scroll across.

  9. #9
    Registered User
    Join Date
    Jul 2007
    Posts
    36
    Quote Originally Posted by MacGyver View Post
    The tutorials on this website are probably very close to the C standard(s). I would also recommend reading this: http://www.howstuffworks.com/c.htm
    Damn! That's quite a tutorial. However, http://www.delorie.com has a huge list of C functions that are common to many implementations of C (on Windows).
    FrancoisSoft
    FrancoisSoft on the Web
    If you stare at a computer for 5 minutes you might be a nerdneck.

  10. #10
    Registered User
    Join Date
    Jul 2007
    Location
    SK, Canada
    Posts
    14
    Quote Originally Posted by zacs7 View Post
    Because it's easier to read and flows well (readability wise). It also usually means the line will fit on the screen and you don't have to scroll across.
    Sorry I asked the question wrong.
    Why at the end of the file is it preferred to have a new line. If I don't add one MinGW tells me, it compiles fine though.

  11. #11
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    If I don't add one MinGW tells me
    One of the more annoying errors. It's not a preference, it's a rule:
    A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character before any such splicing takes place.
    Since this is a "shall" clause, we must emit a diagnostic message for a violation of this rule.
    See this message for the original. There's a sticky at the top of this forum where you can get a copy of a draft of the C language, if you want one.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  12. #12
    Registered User
    Join Date
    Jul 2007
    Location
    SK, Canada
    Posts
    14
    Quote Originally Posted by Cactus_Hugger View Post
    One of the more annoying errors. It's not a preference, it's a rule:
    There has to be a reason for this, right?
    And has anyone had any experience with this would they recommend it?

    Or should I just stick to the on site tutorials?

    Edit: Would this book be recomended to someone like me? The C Programming Language (Paperback) Second Edition
    Last edited by tihoc4n; 07-22-2007 at 10:07 AM.

  13. #13
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    Quote Originally Posted by tihoc4n View Post
    And has anyone had any experience with this would they recommend it?
    it looks incomplete and not proofread, but the information in there is correct from a quick glance.

  14. #14
    Registered User
    Join Date
    Jul 2007
    Location
    SK, Canada
    Posts
    14
    Quote Originally Posted by robwhit View Post
    it looks incomplete and not proofread, but the information in there is correct from a quick glance.
    Ahh thanks.

    I'm going to shift the thread abit. I want to learn C in depth, but most tutorials or online learning aids don't include full C information (like more advanced features of c).

    So I'm assuming I'm going to be looking for a book, is there a definitive book (or online tutorial) out there that covers everything in C?

  15. #15
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My new website
    By joeprogrammer in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 03-17-2006, 07:38 PM
  2. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 01:41 AM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Problem with tutorial (Vector class)
    By OdyTHeBear in forum C++ Programming
    Replies: 4
    Last Post: 12-18-2002, 02:49 PM
  5. My DirectInput tutorial....
    By jdinger in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 06-18-2002, 11:32 PM