Sign in to follow this  
chigga102

Do i learn C or C++?

Recommended Posts

I know there is a thing that is on here but it doesnt go into much detail. i want to start programming and want to make games and only games so i want to know what language i should learn. I want to program football(soccer) games and want to know if i can do it with C and if C++ can u direct me to where i can learn C++ through videos for free thanks.

Share this post


Link to post
Share on other sites
If you want to make games for the love of making games, I suggest C#.
If you want to make games to do this sort of thing professionally, then C++.

For free videos, go to Google.com or Microsoft.com. They have plenty of video tutorials and online text tutorial ready to be watched/read.

Share this post


Link to post
Share on other sites
Usually, when you learn C++, you will learn C as well. But the standards for C++ are different, and C++ uses a lot of functions not available in pure C. I started with C++, but still used some C code. But you may want to do as Dave said, and start with C first, to get used to the syntax. =)

Share this post


Link to post
Share on other sites
There is no reason for a non-professional to specifically learn C over C++ ... it just doesn't make sense to cut off your own hands (no const, strange requirements to typedef a struct to actually use it cleanly, no virtual, no templates, no STL, C gets no love from me anymore).

About the only good thing about C is that since people can't do things like operator overloading or copy constructors, it is harder for them to design bad libraries that hide their badness from you.

And C is a GREAT language to explore for learning the core ideas of the entire von neuman machine (every modern CPU really)

Share this post


Link to post
Share on other sites
I'd say start with C++ and get into object oriented programming as soon as you can. Learning the right way to program in the beginning will ensure that you learn things that you'll actually be using later on. If the C++ standard template library is available, use it! Learning the wrong way to program will give you some pretty horrible coding habbits, so be careful.

Get yourself a good book and read through it chapter by chapter only coming to the computer when you're asked to do an exercise or want to try something out.

Share this post


Link to post
Share on other sites
Very Very simple.

I say, forget about C all together and learn C++.

Someone correct me if I'm wrong but I think there is some stuff you can do in C which is illegal to do in C++.

I Think in C these are legal



// No prototype for this function
int GetNumber()
{
number=getch();
//.
//.
//.
return number;
}


// Implicit int return
GetNumber()
{
//.
//.
//.
}


I think there are others but I can't think of them now

Share this post


Link to post
Share on other sites
The only problem with learning C++ first is that you'll never want to program in C.

If you decide to learn C first, you can appreciate what C++ offers and understand the history a little bit better (not that I recommend this path).

If this is basically your first language, I agree that maybe going C#, Java, Python, etc. is better.

Share this post


Link to post
Share on other sites
Well, the good thing about C++ is that it is based on C so if you do decide to learn C++ first then I would recommend downloading a C++ compiler like

DevC++
Visual C++.NET 2005 express (Download the Plaform SDK if you want Win32 Native programming)

The DevC++ package will be considerably smaller in download size than the Microsoft option for some quick info.

When you want to move on to C++ you won't need to download a new compiler :-)

Share this post


Link to post
Share on other sites
If it's really between those two (and it shouldn't be), you learn C++. C is basically dead these days except for (a) maintainance of existing C code (and there is a lot - the Linux kernel for example - but you probably won't have to worry about it personally) and (b) systems where no C++ compiler exists (generally, embedded systems). Or at least it *should* be.

C++ does provide a lot of complex things that you can learn. There are a few things you should learn that some people will write off as "complex", but will frankly make your life easier in the long run - and the short run, too. With a bit of proper design and good habits, you can write significantly cleaner code, not cluttering things up with weird details about memory management etc., than in C.

Share this post


Link to post
Share on other sites
Quote:
Original post by Boder
The only problem with learning C++ first is that you'll never want to program in C.


And the problem with learning C is that you'll never want to learn B. Or Fortran.

C is a dead language, replaced by C++. There no reason to wake the dead. Learn C++ with the STL, or C#.

Share this post


Link to post
Share on other sites
Quote:
Original post by JBourrie
C is a dead language, replaced by C++. There no reason to wake the dead. Learn C++ with the STL, or C#.


Not entirely, C is much better for compatibility with other languages (binding to Python, ruby, etc.). It is very usefull to know how to write a library in pure C, if you want to script your engine or whatever.

But, from a casual perspective, there probably isn't even that need.

Share this post


Link to post
Share on other sites
There are no industry professionals (not even K&R, or Bjarne Stroustrup) that would encourage you to learn C. C had both flawed concepts and implementations, flaws which were remedied with the introduction of C++.

A similar question would be "Should I read the 2nd edition or the 5th edition of this book on the shelf?" Obviously you'll want to read the 5th edition. The later edition includes more insight, has been critiqued and perfected over a longer duration of time, and has had all the typos and bugs removed as a result of the iterations that came between 2nd and 5th edition. Although C++ was developed in the early 80's (only about 10 years after C was developed), C++ didn't become an ISO standard until approx. 1998. Which means it had nearly 18 years of peer review, performance evaluation, and bug fixes before everyone agreed on the best way to set up the language. Learn C++.

To answer your other question, there will be a workshop beginning June 1st, right here on GameDev.net, where you can learn C++ by reading a commercially available textbook and then discussing and following along with perhaps hundreds of other people. The workshop is free and you can obtain more information about it HERE.

Cheers!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
C++, as was said, get into OOP asap. After all u can program procedural in C++ too.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
Not entirely, C is much better for compatibility with other languages (binding to Python, ruby, etc.). It is very usefull to know how to write a library in pure C, if you want to script your engine or whatever.

Ever heard of extern "C"? [lol]

Don't need to write C code to take advantage of that :)

Share this post


Link to post
Share on other sites
Quote:
Original post by JBourrie
C is a dead language, replaced by C++. There no reason to wake the dead. Learn C++ with the STL, or C#.

...there is still lots of new code written in plain C today.

Just yesterday in the paper shop I met someone who codes for chip cards. In C & asm. [razz]

The guy wore a black shirt with '++ungood' on it. I asked him if he does C++. He said, no, he'd never written a line of C++.

He wasn't too extrovert or talkative, so when our conversation seeped away I got starting to think of how bland and boring his life must be in comparison to a modern C++ programmer, like the prefix increment operator is boring in C compared to it's C++ pendant. The C++ version can be overloaded and templatized to do all sort of things while still looking like a simple preincrement, the C version can only... um... increment.

Just how poor is this guy!

Share this post


Link to post
Share on other sites
Most people learn C++ first, or Java *shudder.* For starters, however, it might be best to start learning on something like Visual Basic or maybe C#, and THEN try C or C++. C/C++ are much more low-level, and require a lot of learning before you can actually start programming games.

-Mike

Share this post


Link to post
Share on other sites
""Most people learn C++ first, or Java *shudder.* For starters, however, it might be best to start learning on something like Visual Basic or maybe C#, and THEN try C or C++. C/C++ are much more low-level, and require a lot of learning before you can actually start programming games""

C/C++ are more low-level? When did this happen.

Share this post


Link to post
Share on other sites
Quote:
Original post by chigga102
i want to start programming and want to make games and only games so i want to know what language i should learn. I want to program football(soccer) games and want to know if i can do it with C and if C++...

You can program your footie game in either C or C++. The question is should you?

What is your target audience? What level of complexity do you imagine for your game (is it to be more like FIFA 06: Road to the World Cup or Sensible Soccer)? How do you plan to distribute this game? Future games? Do you intend to profit directly from sales of this game, or from subscription fees in a pay-to-play networked environment?

Without knowing your requirements, I can't recommend a tool that's ideally suited to your needs. So I will outline a number of positions and the appropriate tools.

Web-based casual game
Say you wish to make a Sensible Soccer-type game without too many nuances of play, consider something like Shockwave. It's a graphically rich environment that can do quite a lot, including 3D. Take a look at some of the games on this site or this site to see what's possible.

Downloadable semi-casual game
If you want something with a little more complexity, but not a full-blown AAA-level game (which, to be blunt, you're not nearly ready to start trying to make, anyway), then consider Java. It abstracts some of the memory management and platform considerations for you, even though it has some nasty properties/shortcomings of its own. Primarily, though, it has a deeper penetration than .NET, and is fully supported on more platforms, broadening your potential audience.

Downloadable or Retail hardcore game
If you want to make something on the FIFA 06 level, then your best options are C++ or C#. C++ will let you squeeze a few extra cycles out of the CPU/GPU here and there, but it comes at the cost of a potentially longer development time, especially if you are not very well versed in the language. So, pragmatically, your choice is C#. At that point, the fact that you can only really deploy a high-performance 3D game written in C# for Windows (yeah, I know, people will point out Tao.OpenGL; this is my post, so these are my opinions) is moot, since that's the majority audience for this sort of game anyway.


Hopefully, this consideration of objectives will help you in selecting both which technologies to embrace and what markets/audiences to target. Good luck, and happy hacking!

Share this post


Link to post
Share on other sites
Quote:
Original post by Rob Loach
I'd say start with C++ and get into object oriented programming as soon as you can. Learning the right way to program in the beginning will ensure that you learn things that you'll actually be using later on. If the C++ standard template library is available, use it! Learning the wrong way to program will give you some pretty horrible coding habbits, so be careful.

Get yourself a good book and read through it chapter by chapter only coming to the computer when you're asked to do an exercise or want to try something out.
I third this. It's good to get into OO early. (I wish I had....)

Share this post


Link to post
Share on other sites
Quote:
Original post by DigiDude
Quote:
Original post by Rob Loach
I'd say start with C++ and get into object oriented programming as soon as you can. Learning the right way to program in the beginning will ensure that you learn things that you'll actually be using later on. If the C++ standard template library is available, use it! Learning the wrong way to program will give you some pretty horrible coding habbits, so be careful.

Get yourself a good book and read through it chapter by chapter only coming to the computer when you're asked to do an exercise or want to try something out.
I third this. It's good to get into OO early. (I wish I had....)


People say this as if it were more difficult to get into it later, in turn as if it were something unintuitive that had to be learned. Something is wrong here; the ideas are really quite simple. It's just purists and pattern-memorizers messing things up.

Get a basic understanding of algorithms and data structures - and I do mean basic - and then start to think in terms of *modelling*. What *are* the "things" in my program? What do they *have*? What do they *know*? What can they *do*? Answer the questions, and design falls into place. (Oh, but do remember to refactor mercilessly.)

Share this post


Link to post
Share on other sites
If it really is C or C++, go C++. (This from someone who prefers C to C++)

Better advice is to learn neither C nor C++. Learn C# or Java or Python. They're mainstream enough to have good resources, they're easier to learn, and they're easier to program in. Really, I think the reason people prefer C++ to these languages is that it is kind of fun to jump through C++'s hoops and creating little forts (a.k.a. idiot-proof classes). I know I sometimes feel the draw, but then I think "Why not just go use C#/Java/Python where that's not even an issue?"

Share this post


Link to post
Share on other sites
Quote:
People say this as if it were more difficult to get into it later, in turn as if it were something unintuitive that had to be learned. Something is wrong here; the ideas are really quite simple. It's just purists and pattern-memorizers messing things up.
I don't mean it to sound as if it's difficult. It's just another paradigm to get used to.

I didn't start using OO but when I got to using it I found programming to be slightly more enjoyable. I'm not saying that the same will be true for him (perhaps I worded my original post badly).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this