C as first language

Started by
40 comments, last by nilkn 15 years, 4 months ago
While assembly is good to learn (once you know it you better understand how computer software works) I wouldn't suggest it to a beginner programmer as they probably wouldn't understand a thing and would get bored pretty quickly.

A scripting language like lua might be a good starting point, or even python.
Advertisement
Use Visual C++ 2008 Express Edition. It supports C and it's free.

Also, do not learn C. Learn C++ instead, you will do yourself a great favour. You can programme in C++ with the same style as in C by using much safer ways.
In any other context, the idea of starting with C++ would elicit massive criticism from lots of people here, because it's a stupid idea and a stupid way to start. Yet the OP asks about starting with C and suddenly C++ is a better choice?

What?

Look, if you're going to start in, the best thing to do is either to start near the bottom of the chain (with C), or near the top of the chain (with C#/VB/Java/Python). Both approaches are legitimate. The reason people usually suggest starting near the top is because learning programming is usually already a goddamn pain in the ass, and it's a hell of a lot more productive and less frustrating to deal with a modern language. People aren't usually compelled to make this stuff harder than it already is. Learning C is a perfectly valid approach, but it starts you in a different place and that place is a lot farther from what most people typically consider to be results. Getting to the point of a functional GUI in C can be kind of a long walk.

Of course, that leaves us with the bastard child, C++. C++ wants to be at both top and bottom of the chain at the same time, and canonical C++ isn't good at either. It provides an effective fascimile of each side and manages to intermix the two, which is rather useful to a lot of people. But as a high level language it's an embarassment compared to C# and Python, and as a low level language it's a pathetic mockery of what C is supposed to be. That, combined with the slew of horrible unseen cliffs of undefined and implementation defined behavior and syntax quirks and all the other wackiness, makes C++ quite possibly the worst possible choice of language to start with, behind even Lisp/Scheme and VB6.

To the original poster JonathanCCC: Both GCC and Visual C++ will compile files ending in a ".c" extension as C, not C++. Just make sure all your files have that extension and you're good.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by Promit
...makes C++ quite possibly the worst possible choice of language to start with, behind even Lisp/Scheme and VB6.


Sorry for going out of topic, but why VB6 is a bad choice? (I'm not saying you are wrong mr Promit, but because I started with VB6 in school...)

I think your choice on first language should depend on how you like to learn.

If you're the kind who doesn't grasp things well unless you can get under the hood and understand *why* things work the way they do, I'd say C/C++ is a good choice. It forces you to understand all these things before you can do anything.

If you're the kind that's just more interested in exercising what computers can *do*, I'd say go with Python, or VB (if you intend to work on GUI-heavy types of stuff).

If you really, really, want to know what's under the hood, learn Assembly :-x Or become an electrical engineer :-)

P.S. If you want to write games (not recommended as a first try though), there still isn't any really good alternative to C++ yet, is there?
Quote:Original post by echo_seven
P.S. If you want to write games (not recommended as a first try though), there still isn't any really good alternative to C++ yet, is there?
Actionscript ?

You may want to look into CodeBlocks (it's free!):

http://www.codeblocks.org/features

Which allows you to use different compilers, I personally use GCC (MingW / GNU GCC)

Unless you want to also learn the joys and pains of makefiles etc, which CodeBlocks handles for you.

Good luck learning C programming!


My shpeal on C/C++ : Different ways to program = different pitfalls, it's how well you know how to avoid/anticipate the pitfalls that make the difference. C being a subset of C++ means it is easier for you to learn and know those pitfalls. C++ Offers different (sometimes easier) ways to do things at the cost of more pitfalls, and a higher learning curve (there are more concepts in C++ because it is a superset!).
I'm too lazy to read every reply in this thread, so forgive me if this has already been said.

One nice feature of C is that it has many different bindings; it tends to have ways to relatively easily access other libraries and languages. That said, learning C isn't a bad idea in my opinion. For aspects that previous posters have said are unwieldy in C (they are), use those bindings. For example, write logic and the bulk of your code in C, and when you need to build a GUI use Python (GTK+ or Tkinker). You can quite easily make your python and C code talk to each other.

One thing to remember is that C and C++ are distinct languages. It's true that C++ is a superset of C, but the idioms used in both languages are very different. Don't be fooled by the infamous "C/C++". [lol]

Go ahead and learn C.
Quote:Original post by sheep19
Quote:Original post by Promit
...makes C++ quite possibly the worst possible choice of language to start with, behind even Lisp/Scheme and VB6.


Sorry for going out of topic, but why VB6 is a bad choice? (I'm not saying you are wrong mr Promit, but because I started with VB6 in school...)
Mainly because it suffers a somewhat broken polymorphism model, that tends to end with very wonky program design.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Quote:Original post by Promit
Quote:Original post by sheep19
Quote:Original post by Promit
...makes C++ quite possibly the worst possible choice of language to start with, behind even Lisp/Scheme and VB6.


Sorry for going out of topic, but why VB6 is a bad choice? (I'm not saying you are wrong mr Promit, but because I started with VB6 in school...)
Mainly because it suffers a somewhat broken polymorphism model, that tends to end with very wonky program design.

Yes one of the main reason's Microsoft decided to ditch it and rewrite it from scratch is the way it's garbage collector dealt with circular references. It was broken bigtime. Anyways, I'm sure there are plenty of articles you could google or that I linked to in the past in previous posts.
Kinda ironic in how fixing a programming language seems to make it even more complex and less fun to use now that I think about it!
VB6 was so easy and simplistic to use but now it's so complex old VB programmers just use C# instead. C++ can be way complex compared to C since it adds all these extra rules to clear up stuff that was unclear or left to the programmer in C so that's probably one of the reason's old C programmers stick to C(they don't like to be told what to do). Same thing has happened to flash/actionscript that happened to VB6. If you look on web people either hate or love the new version!
And lastly let's not forget the latest version of Python,arguably one of the easiest and funnest languages to use, in the latest version instead of the simple Old: print "The answer is", 2*2
New: print("The answer is", 2*2)
you have extra parentheses now!
I'm sure it all goes back to Lisp somehow-LOL!
In that language you are drowning in parentheses since you want to make it absolutely clear to the computer what you are doing-LOL!
[size="2"]Don't talk about writing games, don't write design docs, don't spend your time on web boards. Sit in your house write 20 games when you complete them you will either want to do it the rest of your life or not * Andre Lamothe

This topic is closed to new replies.

Advertisement