Results 1 to 4 of 4

Thread: bacic C program...for the beginner

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jun 2000
    Posts
    537
    I would like to start programing in C but I don't know where to start.
    any good sites out there?
    I am a totaly beginner, so it has to be very basic.

    thank you
    pnj

  2. #2
    Guest
    http://www.cprogramming.com

    most peoples first program is "hello world"...

    Code:
    #include <stdio.h>
    
    int main()
    {
    printf("This is my first C program!");
    return 0;
    }

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I'm going to dive in here...

    Dennis' programming comments are fine, but I would suggest that once you've got the hang of it, look seriously at how you "arrange" your code. For example:
    Code:
    for(int i=0;i<5;i++)
    while(i>3)printf("hi");
    ...that's pretty unreadable. This is better:
    Code:
    for(int i = 0; i < 5; i++) {
        while(i > 3) {
            printf("hi");
        }
    }
    That probably won't make sense, but keep it in mind, and you'll find it a lot easier to work out what's going on.

    Good luck!
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4
    Guest
    parksie is right,
    I didn't indent my code, because it doesn't use any if statements, or loops... but i usually indent if it does...

Posting Permissions

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



Click Here to Expand Forum to Full Width