Thread: Best way to pick up C?

  1. #1
    Registered User
    Join Date
    Nov 2005

    Best way to pick up C?

    I've been doing C programming as one of my subjects last semester for my day release at Uni. Working full time and doing keeping up with uni work is tough, but I have managed it thus far. However, I'm still having SERIOUS problems with C programming. I passed my exam, but my assignment was worthless because I couldn't explain my code to my lecturer. In fairness, although I kinda understand the code, I can't explain it because it's been knocked up and chopped and changed until it worked, with the help of colleagues.

    I don't find C interesting, simple, but I need to grasp it if I am to do my assignment legitimatly and pass the unit. Maybe even if I begin to understand it more I might enjoy doing it.
    Right now I have a spare hour at work, but just looking at my code sends a shiver down my spine.

    Is there any techniques/tips/advice anyone has to take C by the scruff of the neck and hammer it in to submission?

  2. #2
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Sydney, Australia
    Read (and absorb) K&R.

  3. #3
    The Richness... Richie T's Avatar
    Join Date
    Jan 2006
    The best way to learn is from your mistakes. The most valuable
    thing a begginer can do is to obtain reliable demonstration code
    (like the tutorials on this site) and spend a fair amout of time
    playing with said code in order to fully grasp the concept of what
    is being demonstrated. Although you say you understand the
    code, the best way to be able to explain it is to also understand
    how you have applied the features of C to the task.

    A good example of this is if you were asked to write a function
    that performs a certain task, and you are asked to write the code
    to successfully complete the task as efficiently as possible. for
    that you might consider a significant amout of variable reuse,
    perhaps using pointers, maybe even cut corners on unlikely
    cases (not recommended but sometimes people do it). To explain
    that, you would need to know why you are using those features.

    Other strongly recommended tips would be to write functions
    to modularize your program, USE EFFECTIVE INDENTATION and
    also a text editor/IDE configured to highlight matching braces,
    keywords etc. definitely use logical variable names too,
    foo, bar and baz should only ever be used in a pseudocode
    demonstration! Hope that gives you a few ideas
    No No's:
    fflush (stdin); gets (); void main ();

    Example of fgets (); The FAQ, C/C++ Reference

    My Gear:
    OS - Windows XP
    IDE - MS Visual C++ 2008 Express Edition

    ASCII stupid question, get a stupid ANSI

  4. #4
    The superhaterodyne twomers's Avatar
    Join Date
    Dec 2005
    well honestly the best advice I can give you is to practise! seriously! it's the only way to learn things (especially programming!)!

    if you have time, I'd say try out some of the things you learn in the lectures etc. try to modify what was discussed to do slightly different things, see if you can make it better! but seriously, the only way to learn is to practise!

  5. #5
    Join Date
    Dec 2005
    I will strongly echo what the previous posters have said.

    If you're learning to speak Italian, when you first start, everything sounds like gibberish. As you pick up and begin to understand some words and some grammar, more of it makes sense. The more you practice and immerse yourself in it, the more familiar it becomes.

    Pick up the aforementioned K&R (The C Programming Language by Brian Kernighan & Dennis Ritchie). It starts simple and works its way along.

    When you have code examples from class, if you see something you don't understand, attack it -- pick it apart. Ask questions -- of your professor, of your peers and here in this forum.

    Over time, you'll begin to understand more and more....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Write a lucky pick program
    By jianwei87 in forum C Programming
    Replies: 5
    Last Post: 11-30-2008, 10:24 PM
  2. my pick function , need help
    By Anddos in forum Game Programming
    Replies: 0
    Last Post: 11-07-2008, 10:48 PM
  3. Pick a book
    By Daniel Primed in forum C++ Programming
    Replies: 6
    Last Post: 11-04-2005, 02:46 PM
  4. Mind-Reading chip for the disabled
    By JaWiB in forum A Brief History of
    Replies: 6
    Last Post: 04-04-2005, 12:44 PM
  5. Pick character from a string
    By Yoshi in forum C++ Programming
    Replies: 1
    Last Post: 12-22-2001, 07:37 PM