Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Learning C  (Read 1319 times)

Dvergar

  • Bay Watcher
    • View Profile
Learning C
« on: September 17, 2009, 06:06:24 pm »

I have been interested in learning a programming language for a very long time, I have studied Python (script-based language), but I am more interested in the more usefull/powerfull/universal C and C++ languages.  I know many DF gamers and Bay 12 Forum-goers are professional programmers/software engineers, so how would I go about learning C++?  Individual study is pretty hard and the resources I can find on the internet and in the library are pretty scare and many are incredibly technical.  Should I just wise up and take a course? 
Logged

Twiggie

  • Bay Watcher
    • View Profile
Re: Learning C
« Reply #1 on: September 17, 2009, 06:09:32 pm »

not that ive actually learnt c or c++, but afaik you want to learn c first, and then c++, because c is simpler/has more languages based on it

spose i might as well ask here too...
im learning java at school, what's the best way to go from that to C?
Logged

Dasleah

  • Bay Watcher
    • View Profile
Re: Learning C
« Reply #2 on: September 17, 2009, 06:19:21 pm »

not that ive actually learnt c or c++, but afaik you want to learn c first, and then c++, because c is simpler/has more languages based on it

No. Learn C++ first. It is the default language for nearly every application these days, and whilst not perfect, it introduces concepts like Object Orientated Programming that C can't do (well... not do well) that are used in so many languages these days that you'd be hurting yourself to learn it in C, then re-learn it for everything else. Not to say that one shouldn't learn C, of course, but your real focus should be on C++.

Quote
spose i might as well ask here too...
im learning java at school, what's the best way to go from that to C?

Give up, ignore C, and learn Python.
Logged
Pokethulhu Orange: UPDATE 25
The Roguelike Development Megathread.

As well, all the posts i've seen you make are flame posts, barely if at all constructive.

Mr Tk

  • Bay Watcher
  • Would you like a mint? It's only waffer thin.
    • View Profile
Re: Learning C
« Reply #3 on: September 17, 2009, 07:00:54 pm »

C has it's uses. Embedded systems use C because it's small and fast. And some people like it because it doesn't use objects.

Anyway for C++ and C http://www.cplusplus.com/doc/tutorial/introduction/. I always found this a good site.

The only thing which may trip you up is pointers and references and how they operate.
Logged
First ten minutes of play I ate my loincloth and then got some limbs torn off by a super friendly rat. Thumbs up from me.

zchris13

  • Bay Watcher
  • YOU SPIN ME RIGHT ROUND~
    • View Profile
Re: Learning C
« Reply #4 on: September 17, 2009, 07:03:37 pm »

Yeah, I got to that and I smacked my face hard on it.
Logged
this sigtext was furiously out-of-date and has been jettisoned

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Learning C
« Reply #5 on: September 17, 2009, 07:41:38 pm »

Step one: learn basic output.
Step two: using basic output, learn simple math.
Step three: learn input of some sort, or some better output, or something.
b) Arrays.
c) structs
d) If you feel daring, pointers.
Logged
Eh?
Eh!

IndonesiaWarMinister

  • Bay Watcher
    • View Profile
Re: Learning C
« Reply #6 on: September 17, 2009, 07:48:13 pm »

Wait, wait, you said Python is a scripting program?

But, I have seen many pure-Python programs? Isn't what you said would be LUA? (And there is a way to make a pure game out of it... lol)
Logged

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Learning C
« Reply #7 on: September 17, 2009, 08:00:09 pm »

Scripting languages CAN be used to make total programs, but USUALLY must be packaged with an interpreter or attached to a game. If they are compiled, are they still scripts, or are they full programs?
Logged
Eh?
Eh!

Dvergar

  • Bay Watcher
    • View Profile
Re: Learning C
« Reply #8 on: September 17, 2009, 08:16:00 pm »

Some major programs scripted with python are kind of making me think of reverting back for a while, however Python is only used in entertainment from what I have seen (Civilization series, EVE Online, newest line of EA free PC multiplayer games, Battlefield Heroes being most promenent)  Of course I am only a hobbiest, I don't need to know the career-recomended language.

Anyways, my question was not what language to take, but if any programmer out there could tell me if I can learn on my own or if I need formal instruction?
Logged

IndonesiaWarMinister

  • Bay Watcher
    • View Profile
Re: Learning C
« Reply #9 on: September 17, 2009, 10:07:10 pm »

Python is used as a scripting language, yes, but it's not necessarily be used as one.

Also, it was made to make fast, clean language. Not just script.

And there is a ... wait, I don't know the term, but makes .exe files from the source?
Logged

Makrond

  • Bay Watcher
  • Like fuzzy dice, only more slicey
    • View Profile
Re: Learning C
« Reply #10 on: September 17, 2009, 10:58:43 pm »

C and C++ are really two different languages. Trying to use skills - or even syntax - between one and the other is impossible, and pointless.

Learn C++ first. It irons out a lot of bad habits you might pick up doing other languages first (although it may encourage others).

Python is indeed a great language, but it's better to learn discipline and structure before jumping into it, otherwise you can end up with a tangled mess of a program that even you yourself can't maintain because the code is just impenetrable. (I made this mistake with Perl once. Jebus but that language can get complicated fast.)

The best advice for learning what to do is to just basically read tutorials, play around with syntax, concepts, and the structure of programs, and then to think of what you want to do, and try it. If you get stuck, look around for a tutorial for what you want to do, or look through a reference sheet for the syntax you want. Eventually it just kind of all ends up roughly how you want it to and you have a program!
Logged
Quote from: Jusal
Darwinism? Bah! This is Dwarvinism!

qwertyuiopas

  • Bay Watcher
  • Photoshop is for elves who cannot use MSPaint.
    • View Profile
    • uristqwerty.ca, my current (barren) site.
Re: Learning C
« Reply #11 on: September 18, 2009, 07:00:11 am »

I started learning C a few years ago, but at roughly the same time started working with the scripts used by the torque game engine. The end result was that although I learned C, I still got plenty of experience with object oriented code.

The big question of OOC is when to add an additional layer of it. A lot of what I have seen just takes it too far, by applying extreme ammounts to small projects. You DO NOT *need* a new class just to open a window(though it WOULD make future reuse of that code easy), and calling an object's function in the process of parsing a linked-tree-list(In the TGE enviroment) is much slower than(Still from the point of view of a TGE game) adding the new objects to a list and getting back to them later. Especially since the linear method can later be split into chunks if processing everything at once causes too much lag.
Logged
Eh?
Eh!

Muz

  • Bay Watcher
    • View Profile
Re: Learning C
« Reply #12 on: September 18, 2009, 12:30:03 pm »

C and C++ are pretty similar. They taught us C in the early years of uni and expected us to learn C++ by ourselves. They're pretty much different dialects of the same language. I use both of them at the same time, sometimes in the same code :D

If you have the money, I'd highly suggest taking up a course. I tried to learn C back as a kid too, never understood it till uni. Like learning English, it's more practice than anything, though. You'll get nowhere by just doing examples, you have to try and actually make something.

Most of the basic books on it are quite helpful though, but about as costly as a course.
Logged
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

IHateOutside

  • Bay Watcher
  • Fire safety is for wimps.
    • View Profile
Re: Learning C
« Reply #13 on: September 18, 2009, 07:00:30 pm »

I'm having trouble remembering the basic c++ I learn. I know the best way to rember is by practising, but what fun is there in making basic stuff. I know you'll say "it'll be boring until you get the hang of it". How do I make it fun? ???
Logged

Dvergar

  • Bay Watcher
    • View Profile
Re: Learning C
« Reply #14 on: September 19, 2009, 01:44:33 am »

IHate, as you may have guessed I am inexperienced, but my advice would be to pick apart and study open-source programs, that is what I did with python (kinda), who knows you may even end up vastly improving the program.
Logged
Pages: [1] 2