Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Newbie Programmer's tips

  1. #1

    Newbie Programmer's tips

    Those who have recently started programming should keep these tips in mind. It is specially useful for those newbie programmers who have recently started learning a C like programming language.

    1) Whenever you start learning a programming language first of all learn the reserved words of that language. Reserved words are those words that have special meanings for the compiler. Ex. int, char, if, else, for, while etc. are used in C.

    2) Learn the syntax of the statements or functions like printf, scanf etc. The syntax is a correct usage of the statements and functions like those mentioned above.

    3) When you see a complete program then each and everything has a meaning. Try to understand all the meanings of the statements and functions. Ex. printf (“My name is John”); printf function has a purpose; to print everything enclosed within the quotes “ ”. i.e. My name is John.

    4) Most of the structured programs have the format: Input – Processing – Output.

    scanf ( ) function is an input function that accepts a value ( integer, float or character). Eg. scanf(“%d %d”,&a,&b); here scanf( ) accepts the values of a and b. & (ampersand) before each variable is important for each variable to be accepted (inputted) correctly.

    Processing part involves calculations like c = a + b;

    Output part uses the printf( ) function to display the result on the screen. E.g. printf(“%d”,c); this statement simply prints the value of c. %d is called a format specifier and %d represents an integer to be printed if it is used in printf.

    5) When you are making your own program logic, think like a computer. H The way a computer is going to evaluate your logic. A computer would execute your program statement by statement. The normal sequence of execution changes when you use a goto statement or any other transfer of control statement like if, if-else, for, while, do-while, switch statements. Learn the syntax and use of each one of these and try to use these in your programs to practice more.

    6) Try to make your own programs as often as you can, that will enrich you with the correct use of the statements. When you compile (and debug) a program, you might get some errors. Learn from these error messages. These error messages are very helpful. Read them carefully. This will help you in your future programming in C or any other programming language. A long time investment.

    7) Functions are segments of a program. These parts can be used in your programs. Functions can be either made by you or can be picked up from the library. The library is included in the program with the #include statement. printf and scanf are functions pre-defined in stdio.h file. Extension ‘h’ stands for a header file.

    A long one isn't it?
    With great power comes great responsibility.

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    250
    Thanks alot man! Thanks for your time! I'll that in mind! Thank you! I'm happy!
    Got any books to reccomend?
    [gloworange]Die, or surrender, either way won\'t work.[/gloworange]
    [shadow]HuntX7[/shadow]

  3. #3
    Senior Member
    Join Date
    Apr 2002
    Posts
    366
    Nice post! Comes in handy that's for sure.

  4. #4
    AO Antique pwaring's Avatar
    Join Date
    Aug 2001
    Posts
    1,409
    A lot of this is fairly obvious though, you don't have any choice as to learning the syntax of programming languages so it's not a tip to tell people to do so. If you use a reserved word or incorrectly call an unnamed function then the compiler will generate an error message.

    Some good tips for absolute newbies though I suppose...
    Paul Waring - Web site design and development.

  5. #5
    Antionline Herpetologist
    Join Date
    Aug 2001
    Posts
    1,165
    I learnt all this the hard way, so it's nice to see someone helping newbies out.
    Cheers,
    cgkanchi
    Buy the Snakes of India book, support research and education (sorry the website has been discontinued)
    My blog: http://biology000.blogspot.com

  6. #6
    Senior Member
    Join Date
    Nov 2001
    Location
    Ireland
    Posts
    734
    Hmm, this was posted a while ago, but in the form of a song...
    I prefer this version though, well done.

  7. #7
    Junior Member
    Join Date
    May 2002
    Posts
    18
    this should help me out a bit, thanks.

  8. #8
    nice post.
    Attitude is a small thing that makes a BIG difference.

  9. #9
    Hey huntx! Out of all the c/c++ books I liked books from Robert Lafore. Waite Group's Object oriented programming in Turbo c++ is excellent for c++ programming. You will also find c programming books from the same publisher. Turbo c is also well written, in a simple yet elegant manner.
    With great power comes great responsibility.

  10. #10
    Old-Fogey:Addicts founder Terr's Avatar
    Join Date
    Aug 2001
    Location
    Seattle, WA
    Posts
    2,007
    And a quick note to add:

    It's good to always always always (it's habit forming if you don't) //comment nearly everything that it makes sense to comment. Otherwise you might make a program, and a month later spend way too much time trying to figure out how you did it and what a certain function was for.
    [HvC]Terr: L33T Technical Proficiency

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •