Archived

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

shuks

C before C++???????

Recommended Posts

shuks    122
Is it woth learning C before delving into the world of C++? I know a bit of VB but then decided to learn C++. After a while i thought it would be better if i started out with C before going on to C++. I like the simplicity and power of C and i am enjoying learning it but what bothers me is that is it worth learning it while the world of game programming is using C++? Please help me out!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Piggyback question:
I have heard C++ called "C with classes" but I am sure this is not all there is to it.
Does anyone know where I can find a list of the differences between the two languages online? I am poor and I don''t feel like reading the official specs for both.

Share this post


Link to post
Share on other sites
LessBread    1415
The question of whether or not it''s better to learn C before C++ can be answered both yes and no. I would say yes, but I know others would say no, learn Java then learn C++.

Learning C first can serve to impart an understanding of how to declare functions, variables etc, how to use the standard library routines or other api''s and more importantly how to use pointers and allocate memory. It''s also good for learning how compilers/linkers work and how programs are built from source code.

I''m not familiar with any documents constrasting the differences between the two languages - but I would guess that such an item exists someplace. I''ve seen polemics on the subject of which language is superior. I''ve only read the one at Amit Patel''s web site. Draft copies of the language specs an be found on the www - one has to search for them - however. For this kind of information a search engine is your friend. Check google, check the new group listings at google, check alltheweb, check your fav engine...



‘But truth's a menace, science a public danger.’ Brave New World, Aldous Huxley

Share this post


Link to post
Share on other sites
JoeyBlow2    100
Yes, learn C first.

C gives you the basic understanding of the language. The syntax, how to declare things, pointers, etc. How compiling works (headers and libraries)

C++ uses the above and enhances it. If you run into problems with C++, and don't understand C... You can still learn the things above, but you just added more "headache" to situation.

You can still write any program using just C... I've made DirectX and games using straight C...

C++ was made to make C a bit more friendly to developers to organize things. Let's say you have a bunch of functions in a .c file that only have to do with graphics. It has globals defined to access DirectX... You include them into your project. Fine. You get the job done.

In C++, you have a class that you include in a .cpp file... It has a list of functions. Instead of global memory, you have the class handle the global variables.

Let's say you have graphics and sound in a C program. You have 2 functions "Clear(SoundVarible)" and "Clear(GraphicsVariable)" (using overloading) Lets say someone else is using your program and wants to clear the sound. They gotta hunt for "Clear(soundvariable)" and figure out how to use it. They have to find out where the Sound/GraphicsVariable is defined and its name.

In C++, you have your sound/graphics in a seperate class... You would say "Sound->Clear" or "Graphics->Clear" no need to find the variables, because you define your variables in the class... Since you are using the class to Clear. The code in the class knows where to find it.

It just makes things easier to use...

But both are just as powerful and you can do whatever you want using both. Most people in the "gaming world" use C++ because multiple people can be working on it at once and its alot easier to read and use classes when sharing a project.

But like I said, its easier to learn C... Start with it to get familiar, then learn C++ to learn all the good things about it and start to use it.

Edited by - Joeyblow2 on January 2, 2002 4:22:09 PM

Share this post


Link to post
Share on other sites
JonStelly    127
I would say do whatever you feel like. Either way has merit, either way adds some difficulty. It all revolves around how you go about learning the language(s). If you start slow with C++ and don''t try to rush into classes, then you shouldn''t have any more problems than learning C then C++. In fact, the minor differences in syntax between C and C++ might trip you up if you learn C first. On the other hand, there isn''t any temptation to use classes too early with C, so you''ll have to stick to the basics, which can be a good thing. Personally, I learned C++ first, there''s a great book from the Waite Group called ''Object Oriented Programming in C++''. Don''t let the title fool you, it provides plenty of simple background on variables and non OO ideas of the language.

Share this post


Link to post
Share on other sites
shuks    122
Thanks alot Joeyblow and LessBread!!!!!!!
That was really kind of you guys to explain it in detail to me. Everybody has got his/her opinions about that. But you gave me good examples of how they differ and why one is used over the other. I guess i''ll continue learning C for the moment!

Share this post


Link to post
Share on other sites
Arild Fines    968
http://www.research.att.com/~bs/bs_faq.html#prerequisite

Fantastic doctrines (like Christianity or Islam or Marxism or Microsoft-bashing) require unanimity of belief. One dissenter casts doubt on the creed of millions. Thus the fear and hate; thus the torture chamber, the iron stake, the gallows, the labor camp, the psychiatric ward - Edward Abbey

Share this post


Link to post
Share on other sites
Nacho    205
I spent six or seven months learning C and when I got a good grasp of it I then switched to C++. I recommend you to learn C first before C++ and, if you want a good book of C++, Sams Teach Yourself C++ in 21 days by Liberty is the way to go. I also recommend you to check old messages topics under the subject C vs C++ or similar, there are plenty of them!

Share this post


Link to post
Share on other sites
EvilCrap    134
if you have studied VB enough to write linked lists in VB, then you should go straight to C++. Id say that the only reason to study C first is to get an understanding of procedure and flow.
although im all for going straight to c++, you must manage to learn legacy C sooner or later -if you dont, then you will really have a lack of knowledge--- c++ programs tend to abound with c functions (simply because they can... not because they should)!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
follow that link! Bjarne Stroustrup is both a very smart man and the inventor of C++. After reading the paragraph linked to go and read the pdf there too.

Share this post


Link to post
Share on other sites