Archived

This topic is now archived and is closed to further replies.

Learning C++, about C

This topic is 5512 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was reading on Amazon and they had a person give a list of books that would take you from C to C++ on to game programming. I was wondering if there is any reason to learn C before C++ or what some good sites to build my knowledge on either of these might be. Thankyou

Share this post


Link to post
Share on other sites
Now, most people will say "Go for C++". ...That's because they don't know. You really should learn C before C++ because C books have more details on the basics/basic techniques without going into the overhead of OOP. Alot of people say, "It too god-damn hard to move from C to C++". It's not that hard, really. Alot of C++ professionals have all the great C books. Hell, even Stroustrup the man himself said that you should learn C first. Do it or die.

EDIT: typos
Hey amigo, I am a coderito sitting in your borito(and cuttin')

[edited by - Fucho on November 5, 2002 11:45:34 PM]

Share this post


Link to post
Share on other sites
Where does Stroustrup say that you should learn C before C++? If I read his books correctly, and his website's FAQ, he says the exact opposite... No you should not bother learning C before C++. Going back and reading the C 89 and C99 standards after learning C++ doesn't hurt though, and that I recommend. You just need to know the differences between the 3. A good book to begin with is Accelerated C++. That'll get you a strong base of knowledge, one that'll need to be extended by design books, more in-depth STL and template-related books, and eventually, or during the same time, graphics theory and alike.

[edited by - aggregate on November 5, 2002 11:56:14 PM]

Share this post


Link to post
Share on other sites
I swear I read an article somewhere that talked about the differences between C and C++. It read something like:
"Should you learn C before C++? Stroustrup thinks so..."
I just spent 30 minutes trying to find it and failed...

Maybe I need to keep my mouth shut.

Hey amigo, I am a coderito sitting in your borito(and cuttin'')

Share this post


Link to post
Share on other sites
I don''t think it really matters where you start, as long as you eventually come to understand paradigms like OOP. I myself started in qbasic, then moved straight to C++. It was rather easy, actually.

In qbasic, there are basically no function calls or parameters. Therefore pretty much everything has to be global (bad). As I read into programming, I learned that globals were bad (hard to manage). I didn''t know how I could do that in qb, so I looked into other languages. I looked at C, but it seemed like I would still have to pass a whole bunch of parameters around all the time to get it to work.

Then I looked into C++. Classes seemed like a way to use globals (public members), without them being "global", so I decided to go with C++. Of course, I learned that making everything a public member was bad, so I made things private. Private members were basically global to the class, and as long as the class was the only thing that used those variables, I had my globals back, "The Right Way"(tm).

Later on, encapsulation, data-hiding, and polymorphism came naturally to me, because I understood the basic idea. So, even though I started in qbasic and programmed with it for probably 1 1/2-2 years, I was able to grasp the concept of C++.

Maybe not all are like me, but I say to start with whatever seems easiest to you. If you enjoy programming (which is hard to do if you think the language you''re learning is difficult), you''ll eventually venture into other languages and better paradigms. If you started in an ugly language (basic, etc), you''ll learn that OO is easier. If you started in an OO language, you''ll learn you made the right choice.

So, just have fun with programming; that will help more than choosing the "perfect" language to start with.

Share this post


Link to post
Share on other sites
I had gone through C before C++. It''s not a case of having to learn C before C++, or not learn C before C++, it''s a case of if you have had the benefit of knowing C before C++ then learning C++ will be accelerated.

I beleive that ultimately, whether you know C beforehand, they will be as good as each other.

Sometimes people forget that C++ is a language in itself.

Peace out,
Mathematix.

Share this post


Link to post
Share on other sites
Having a background in C would be useful, however starting from scratch. I would recommend learning C++. Learning C alone is learning features which have features/aspects which have been improved. If on the other hand, you are learning as a hobby/interest. You may find it interesting how the language evolved by going through the subset. If you can afford to purchase books on each subject go ahead (Although there are some books which explain both). I personal have a large collection of books. It is surprising how much you can learn without tutoring (Imagine how much it would cost for education bills).

*Note* Fucho obviously thinks Stroustrup doesn''t understand C++.

Share this post


Link to post
Share on other sites
________________________________________________________________
From: stroustr@cs.tamu.edu
To: Fucho77 < fucho77@hotmail.com>
Subject: Re: Learn C before C++?
Date: Wed, 6 Nov 2002 09:11:13 -0600

________________________________________________________________

Quoting Fucho 77 < fucho77@hotmail.com>

> Hello,
>
> Us C/C++ programmers over here at www.gamedev.net are wondering if you
> recommend learning C before C++? Yes I know it sound dumb.
>
> Thank you for your time
>

I recommend learning C++ before C. There is a brief argument in my FAQ and a
more detailed one
in my paper "Learning Standard C++ as a New Language" which you can download
from my home
pages.

bjarne

________________________________________________________________

Well alright. I was wrong.

EDIT: tags
Hey amigo, I am a coderito sitting in your borito(and cuttin')

[edited by - Fucho on November 7, 2002 1:33:38 PM]

Share this post


Link to post
Share on other sites
Ok well I''ll read C++ Primer Plus then. I don''t know where I''ll go after that but...I have time. Thanks everyone, if you want to post URLS of good tutorials for either of the languages that would be nice. Bye

Share this post


Link to post
Share on other sites
quote:
TheSimplerOne said:
Ok well I'll read C++ Primer Plus then. I don't know where I'll go after that but...I have time. Thanks everyone, if you want to post URLS of good tutorials for either of the languages that would be nice. Bye


Good choice on a C++ book.

Here are some tutorials:
www.gametutorials.com
www.cprogramming.com
www.cplusplus.com


Hey amigo, I am a coderito sitting in your borito(and cuttin')

[edited by - Fucho on November 7, 2002 7:50:44 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
When is the bullshit going to stop? Fucho, stop spreading this C bull, C++ is more modern. You were wrong about more than the quote. Learning C first is learning bullshit you must forget such as the default to int rule. There are many more examples but I do not wish to give a history lesson today.

Basically you need to master the ability of detecting bullshit. People will send you down the "wrong" path. Thus disrupting your learning curve.

Share this post


Link to post
Share on other sites
I decided to learn C before venturing into C++, and learning C++ is getting to be pretty easy. Although there are some concepts that are hard to grasp, without C I would not have been able to go this far in C++ as fast as I did.

C cannot hurt your programming styles in C++. All you have to do is modify a few things, and you''re set. Plus, 90% of game programmers learned other languages before C++, even Lamothe knew C before C++, I don''t see him complaining

Thomas Sauder

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
When is the bullshit going to stop? Fucho, stop spreading this C bull, C++ is more modern. You were wrong about more than the quote. Learning C first is learning bullshit you must forget such as the default to int rule. There are many more examples but I do not wish to give a history lesson today.

Basically you need to master the ability of detecting bullshit. People will send you down the "wrong" path. Thus disrupting your learning curve.




Look man, just shut your ass. C++ is more modern? WTF do you mean by that? C is still widely used today, and it''s not the "wrong" path if you learn it first. If C is "bullshit", then why is it still used? I just think that C is easier for teh beginner. C and C++ are equally good. You tryin to start a flamewar?

Share this post


Link to post
Share on other sites
quote:
I was wondering if there is any reason to learn C before C++

You essentially learn C on your way to learning C++. In fact, if you compile your C language program with a C++ compiler, it should compile with no changes or very few changes.

I learned C before C++ and that has value. It lets you understand the C language so you can differentiate it, and so you can understand how C++ is mostly an extension of C, adding object-oriented features and useful templates.

You may find yourself dealing with libraries and source code written strictly in C, so knowing where C ends and C++ begins will elp you understand the reasoning behind code written in C.

So learning C is time well spent, because you are learning part of C++ as well. It helps you better understand where you cross over from stuctured programming (in C) to object oriented programming (C++), and makes you better equipped to deal with a variety of source code written by others.

Value of good ideas: 10 cents per dozen.
Implementation of the good ideas: Priceless.

Proxima Rebellion - A 3D action sim with a hint of strategy

[edited by - BS-er on November 8, 2002 4:37:28 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You obviously don''t know what you are talking about Fucho, shut it before you dig the hole your in deeper.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Fucho, C is still used today? That might be the case but most programmers who prefer the procedural style still take advantage of C++ over C. As Stroustrup has stated, C++ can be used as a better C. I really thing you should do some research before trying to put yourself across as a "veteran" programmer.

Share this post


Link to post
Share on other sites
hm..so many debates about C and C++, so I'd put some of thoughts in.

Basic of C:

#include // how you include files
#define // how you define things or "constants"
int main() // how you write your main function / body
return // it'a about ending a function
for ( ; ; ) // for loop
switch () // switch case
if () else // if then else statements
void myfunction() // writing your own function
int myvar // writing your own variables
struct mystruct // writing your own struct
enum myenum // writing your own enumeration
+,-,*,/ // your first arithmetic
+=, -=, *=, /= // a more advanced use of arithmetic
>>, << // binary shift!
<<=, >>= // a more advanced use of binary shift
int *pointer // yuck, it's a pointer!
malloc, free // dynamic memory allocation


Basics of C++:

cout << "hello world" // using cout..again, *using* cout, with a binary shift operator? i wonder how do you binary shift a string...
class myclass // how you write your own class
public,protected.. // security thingies
const // the true constant finally here!
& // hm..reference...
new delete // dynamic memory allocation, C++ style.



now, what you see in a typical C++ tutorial..or I must say, the C++ "Hello World":

#include <iostream.h>

int main()
{
cout << "Hello World" << endl;
return 0;
}

how many C basics that you see compared to C++ basics in that piece of code? Roughly, 3:1. Conclusion? Learn C first. Go C++ after you grasp the basic. If you go straight C++, you kill yourself. Why? There is no way you can create a useful class without knowing how to write a function or variable (which is in C). So, why do people suggest to learn C++ instead of C? Because they think writing a variable is part of C++ basic. When you read a C++ book/tutorial..then the author tells you how to write a variable...he's teaching you C, not C++.

EDIT: some spelling errors

[edited by - alnite on November 9, 2002 12:24:57 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
<sarcasm>Oooooooh, that’s why C++ is so puzzling to me I didn''t learn variables! Or functions! *sigh* 2 years of programming and I forgot to learn C. </sarcasm>

My advice. Don''t learn from a newbie... Learn from a book.

Share this post


Link to post
Share on other sites