Jump to content

C necessary before C++?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
63 replies to this topic

#1
Sanity Pig

Sanity Pig

    Newbie

  • Members
  • Pip
  • 1 posts
Just having finished Intro to Comp. Sci. my Sophomore year of High School, I wanted to expand my horizons into C/C++ (being that many video game companies require that in a programmer, and that is what I aspire to be, a video game programmer). But is it necessarry to learn C before C++?

I have gotten some mixed results from googling this. While my mom (she is a programmer, long forgotten C/C++) says that I should/it wouldn't hurt, many people on the interwebz seem to think otherwise.

I have been lurking around this website for a wee bit, and everyone here seems very (more so than I, at least) knowlegable about these types of things, so I opted to ask.

Oh, also I spent that year of Comp. Sci. with Java, if that makes any difference.

Thanks!

Side note:
If there is any other advice you have for a new programmer, it would be greatly appreciated!

EDIT: Just noticed the "FAQ" thread. I appologize in advance if this would have been better suited to go in there instead!

Edited by Sanity Pig, 14 June 2009 - 10:21 PM.
Readablility


#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
No, there is no reason you need to learn C before C++.

#3
ArekBulski

ArekBulski

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,376 posts
Well, I more or less learned C++ all by myself, and I still do not know how C code looks like... So my educated guess is that you do not need to learn C. I used the Code::Blocks IDE for coding. I dislike how debugging works there though.

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
If you are familiar with Java, you will find C much more frustrating to learn than C++. I learned C, then C++, then Java, then dove back into C++. Going from C to C++ involves a LOT of unlearning. C uses scanf() and printf() for input and output, with format strings that people tend to screw up on a regular basis. C++ uses cin and cout, stream objects, to automatically handle most of the details. Since Java took a lot of ideas from C++, they look fairly similar. I've even read some guides to help Java programmers transition to C++.

Overall, learning C isn't really going to help you learn C++. The things that it could (in theory) help with you will already get from Java.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
It would not hurt, but as Jordan said, it is unnecessary. That said, if you learn basic C++ you already know most of C. It might be worth looking at the few differences, so that you can make your way around C as well, because, after all, many people expect C++ programmers to know C.

Posted via CodeCall Mobile

#6
Aereshaa

Aereshaa

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 790 posts
I personally learned a bit of C++ before C. I don't really know which is harder, but C involves lots of pointers, which are (many people say) a huge mental leap to make. But then again, YMMV, because I personally find pointers easy compared to understanding multiple inheritance or templates in C++. (x_x) All languages have their quirks, but which are hard depends on the individual.
Watches: Nanoha, Haruhi, AzuDai. Listens to: E-Type, Dj Melodie, Nightcore.
"When people are wrong they need to be corrected. And then when they can't accept it, an argument ensues." - MeTh0Dz

#7
awazdohamko2004@gmail.com

awazdohamko2004@gmail.com

    Newbie

  • Members
  • PipPip
  • 25 posts
well to be straightforward and to the point here in indie we are made to learn C programing before C++ and it kinda helps the student as to what is the difference between the two languages and it indeed helps to make your fundamental stronger

#8
outsid3r

outsid3r

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 623 posts
Many people ask that question, and the answer in my opinion is no. You don't need to learn C before go into C++ because they are 2 almost completly different languages, they only share some syntatical and semantical structures. However it's great for you to know C to boost your overall programming knowledge.

Quote

well to be straightforward and to the point here in indie we are made to learn C programing before C++ and it kinda helps the student as to what is the difference between the two languages and it indeed helps to make your fundamental stronger

Yea, in all universities they teach C before C++ for people know the differences between programming paradigms.

#9
Float(pi)

Float(pi)

    Newbie

  • Members
  • Pip
  • 1 posts
C is based on structured programming, C++ is object oriented. Many programmers believe that learning C will hinder your future studies in C++.

#10
marwex89

marwex89

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 10,720 posts
I would never go as far as saying that learning C will hinder you. Not all of C++ is object oriented, and it is up to the programmer to choose how to solve a problem. One of the great things about C++ is that it always lets you choose, and very often you have the option to do it the C-way, a way I believe one should be aware of, even though you choose not to use it. In my experience, learning C will only be positive for your C++ studies. It is true that some things are done differently in C++ (i/o, typecasting etc), but I strongly disagree that knowing a different way of doing things (the C-way) is bad. It will only broaden your horizon. If you are in a hurry, however, it is perfectly fine to skip the C part. But I believe that knowing C can make you a better C++ programmer.

Posted via CodeCall Mobile

#11
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Here's an example of how C++ can help you in ways C can't:
#include <gmpxx.h>
#include <iostream>
using std::cout;
using std::cin;

int main()
{
  int num;
  cout<<"Pick the number you want to raise to a factorial: ";
  cin<<num;
  mpz_class fact=1;
  for(int j=1;j<=num;j++)
    fact*=j;
  cout<<num<<"! = "<<fact<<"\n";
  return 0;
}
It uses the GNU Multi-Precision library, which provides a class for arbitrarily large "integers". As a result, it is object oriented. The class is a wrapper for a collection of C functions, so you can use this library with C as well. However, just looking at the code, it appears to be a simple procedural program with a funny data type. This is the power of C++. You can create classes that simply get out of your way and let you work without thinking too much about them. The C version of this program, using the same library, is much more complicated and imposes more responsibility on the user.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#12
ArekBulski

ArekBulski

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,376 posts
Interesting elaboration, Winged. So is this topic going wider? Perhaps we could ask: should he learn assembler before C before C++ before C#?