PDA

Click to See Complete Forum and Search --> : bacic C program...for the beginner


pnj
Dec 29th, 2000, 02:06 PM
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

Dec 29th, 2000, 02:16 PM
http://www.cprogramming.com

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


#include <stdio.h>

int main()
{
printf("This is my first C program!");
return 0;
}

parksie
Dec 29th, 2000, 05:43 PM
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:

for(int i=0;i<5;i++)
while(i>3)printf("hi");

...that's pretty unreadable. This is better:

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!

Dec 29th, 2000, 05:46 PM
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...