Learning to program in C

Re: Learning to program in C

Damocles said:
DiscoSteve said:
#include<stdio.h>

main(int argc, char *argv[])
{
printf("Hello world\n");
}

Still got it!

#geekalert

try reading this
<a class="postlink" href="http://crasseux.com/books/ctutorial/index.html#Top" onclick="window.open(this.href);return false;">http://crasseux.com/books/ctutorial/index.html#Top</a>

That's a failure.

You didn't return an integer in main, and you didn't declare its type (it varies across different compiler implementation). You can probably get away without the return value as main implicitly returns 0 according to the standard, but you leave it in just in case.

The better way would be:

Code:
#include <stdio.h>

int main(void)
{
     printf("Hello, World");
     return 0;
}
quote]

Also note the lag of a newline character and lack of arguments to main, these are not strictly required.  The argc/argv convention is dependent on the platform that you are writing on.[/quote]

Haha. Failed attempt on using [code] :)
 
Re: Learning to program in C

BulgarianPride said:
Damocles said:
DiscoSteve said:
#include<stdio.h>

main(int argc, char *argv[])
{
printf("Hello world\n");
}

Still got it!

#geekalert

try reading this
<a class="postlink" href="http://crasseux.com/books/ctutorial/index.html#Top" onclick="window.open(this.href);return false;">http://crasseux.com/books/ctutorial/index.html#Top</a>

That's a failure.

You didn't return an integer in main, and you didn't declare its type (it varies across different compiler implementation). You can probably get away without the return value as main implicitly returns 0 according to the standard, but you leave it in just in case.

The better way would be:

Code:
#include <stdio.h>

int main(void)
{
     printf("Hello, World");
     return 0;
}
quote]

Also note the lag of a newline character and lack of arguments to main, these are not strictly required.  The argc/argv convention is dependent on the platform that you are writing on.[/quote]

Haha. Failed attempt on using [code] :)[/quote]

Try learning Ada Lovelace and that will send you over the edge ;);)

C  is easy and so is passing arguments by address. ;)
 
Re: Learning to program in C

Damocles said:
Some tips:

Don't start with C if it's your first language. C is fucking hard because you have almost complete control over the machine. Ive been programming for over fifteen years, ten of them in C, and I never use it unless totally necessary.

Programming isn't something that you can pick up in a weekend. It combines linear algebra, boolean logic, systems engineering and computer design. The idea that you are going to learn C, then Objective C, then make an iPhone app if you are coming from a non programming background is incredibly unrealistic. It will take you a good six months just to get your head around C. Another year to understand proper program design. Then you have to learn Apples API.
Think of them as spoken languages. You are basically saying that you are going to pick up Traditional Chinese, then Shanghai Chinese then translate the Bible into it. It's possible, but it's an awful lot of work.

Avoid the Teach Yourself in 24 hours books, they only show you syntax and don't explain the whys or hows.

If you want to learn how to program, start in VB.NET. Once you know about object orientated programming (classes, interfaces, inheritance, polymorphism, encapsulation, etc) then read Gang of Four and learn about design methods. Then look at functional programming, structured programming and the other paradigms to see what the difference is and why they are used. Then, after you've made a few apps in VB, go and learn Objective C directly. You would have already learnt the major programming principles, so you now only need to learn abput typing, pointers, memory management and garbage collection before you know what you're doing. Well, for a start at least.

C is easy

C++ is harder

Ada is a nightmare.

C# is apparently easy
 
Re: Learning to program in C

I studied C++ for two years at school and then C for a year at Uni. I find that C++ is much much easier.
 
Re: Learning to program in C

I'm starting to realise how much of a prejudice I've built against microsoft down the years but I guess the outside world is different to defence.

Then again HMS Dauntless Command and Control uses Microsoft and is steaming round the Falklands so maybe I was wrong.
 
Re: Learning to program in C

I joined University course which had a C++ module in it and I could not do it!!
I have a lot of respect for people who can program, my brain is not up to it!
Or it might be I find it boring as shit and I can do anything else but programming on a computer?
 
Re: Learning to program in C

Damocles said:
Some tips:

Don't start with C if it's your first language. C is fucking hard because you have almost complete control over the machine. Ive been programming for over fifteen years, ten of them in C, and I never use it unless totally necessary.

Programming isn't something that you can pick up in a weekend. It combines linear algebra, boolean logic, systems engineering and computer design. The idea that you are going to learn C, then Objective C, then make an iPhone app if you are coming from a non programming background is incredibly unrealistic. It will take you a good six months just to get your head around C. Another year to understand proper program design. Then you have to learn Apples API.
Think of them as spoken languages. You are basically saying that you are going to pick up Traditional Chinese, then Shanghai Chinese then translate the Bible into it. It's possible, but it's an awful lot of work.

Avoid the Teach Yourself in 24 hours books, they only show you syntax and don't explain the whys or hows.

If you want to learn how to program, start in VB.NET. Once you know about object orientated programming (classes, interfaces, inheritance, polymorphism, encapsulation, etc) then read Gang of Four and learn about design methods. Then look at functional programming, structured programming and the other paradigms to see what the difference is and why they are used. Then, after you've made a few apps in VB, go and learn Objective C directly. You would have already learnt the major programming principles, so you now only need to learn abput typing, pointers, memory management and garbage collection before you know what you're doing. Well, for a start at least.

Very good points Damocles.<br /><br />-- Tue Feb 14, 2012 6:41 pm --<br /><br />
skyblue78 said:
I joined University course which had a C++ module in it and I could not do it!!
I have a lot of respect for people who can program, my brain is not up to it!
Or it might be I find it boring as shit and I can do anything else but programming on a computer?

You have a normal brain. Nothing wrong with that.

Software and Systems Engineers are a consequence of evolution.
 
Re: Learning to program in C

Rascal said:
nijinsky's fetlocks said:
Three pages into the thread,and I don't have a scooby what it's about.

Upstairs
It's just like being upstairs
It's just like being upstairs
It's just like being upstairs.

Agreed.

And i anticipate it getting more geeky

Its a great thread there's no arguing and its very educational to.
 

Don't have an account? Register now and see fewer ads!

SIGN UP
Back
Top
  AdBlock Detected
Bluemoon relies on advertising to pay our hosting fees. Please support the site by disabling your ad blocking software to help keep the forum sustainable. Thanks.