Thread: Exercises For Better Programming

  1. #1
    Registered User
    Join Date
    Sep 2010
    Posts
    46

    Exercises For Better Programming

    Hey guys, I am in school for Computer Science. I enjoy programming and really want to develop into a strong programmer. Please post exercises (for C) that will make me a better programmer.

    I am a beginner still, so don't go too challenging on me. Things that require the uses of pointers will help me learn a lot because I am not too strong on pointers.

    Also, I would love to hear about real world examples of what you guys do in programming. Right now my labs have me doing things that seem quite arbitrary. Thanks all!

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    I think there has been a thread on this subject a while ago where people posted various exercises. You may want to do a search on this forum to find it. I think it was started by matthayzon89.

    Cheers!
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by askinne2 View Post
    Also, I would love to hear about real world examples of what you guys do in programming. Right now my labs have me doing things that seem quite arbitrary. Thanks all!
    Only arbitrary in that they may not be things you'd be called on in real world programming. But I'm betting the concepts you are working through will carry you well when you encounter the little examples as part of a much larger project.

    My current project? HTPC remote control via LAN. Presently in final stage Alpha test...

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Please post exercises (for C) that will make me a better programmer.
    In the past I've always suggested that a good way to improve is to frequent these forums. Try to answer the questions and solve the problems posted, even if you don't actually reply with your answer. Of course, replying with an answer and having it corrected is also a good way to learn.
    My best code is written with the delete key.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Stick around for a few days, there are any number of homework questions which you could try to tackle for your own education and amusement.

    Or google "programming contests"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    Project Euler is a collection of problems that I like - they start out fairly easy and get harder.

    Most (though not all) have a slightly mathematical bent. They're not geared towards any particular language, which is half-way to being like real-life problems - you need to solve whatever problem it is that you need to solve, and the problem doesn't care what language you use. Additionally, after you've done each problem you can see others' solutions and learn from them.

  7. #7
    Registered User
    Join Date
    Sep 2010
    Posts
    46
    Quote Originally Posted by JohnGraham View Post
    Project Euler is a collection of problems that I like - they start out fairly easy and get harder.

    Most (though not all) have a slightly mathematical bent. They're not geared towards any particular language, which is half-way to being like real-life problems - you need to solve whatever problem it is that you need to solve, and the problem doesn't care what language you use. Additionally, after you've done each problem you can see others' solutions and learn from them.
    This looks awesome! I am going to start these right away. Has anyone here been able to solve all of them or a large amount of them?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 20
    Last Post: 09-29-2010, 11:56 AM
  2. C Programming Exercises
    By heiroglikano in forum C Programming
    Replies: 7
    Last Post: 05-23-2009, 10:37 AM
  3. seeking for exercises
    By smoking81 in forum Linux Programming
    Replies: 7
    Last Post: 09-14-2008, 06:46 PM

Tags for this Thread