C Board  

Go Back   C Board > Community Boards > General Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 11-04-2009, 08:50 AM   #1
Registered User
 
JOZZY& Wakko's Avatar
 
Join Date: Nov 2009
Posts: 25
C or C++

If I got it right C# is basically meant for the Windows OS. But what are the differences exactly between C and C++ and what would be better to learn?
JOZZY& Wakko is offline   Reply With Quote
Old 11-04-2009, 08:56 AM   #2
Jack of many languages
 
Join Date: Nov 2007
Location: Katy, Texas
Posts: 1,929
You should learn them both. Lots of common aspects between C and C++.
__________________
Mac and Windows cross platform programmer. Ruby lover.

Memorable Quotes From Recent Posts:

I can't remember.
Dino is offline   Reply With Quote
Old 11-04-2009, 09:44 AM   #3
l'Anziano
 
DavidP's Avatar
 
Join Date: Aug 2001
Posts: 2,573
Agreed. If you are going to learn either C or C++, you might as well learn both. They are used heavily together. C code is very often mixed in with C++ code, especially in legacy code if you ever have to go and read legacy code for any reason.

C# is primarily for Windows, but it has been ported to Linux as well. I assume since it has been ported to Linux, you can also write C# code for for Mac OS X...but that is pure speculation on my part.
__________________
My Website

"Circular logic is good because it is."
DavidP is offline   Reply With Quote
Old 11-04-2009, 11:45 AM   #4
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
Learning both languages is silly. You want to learn either. When learning C++, you would also like to learn something of its low-level basics, which is normally inherited from C, but with some differences.
What to choose? Well, aside from the whole what you like best argument, for anything but stubborn integrated platforms, I would choose C++ simply because it is much more powerful and flexible than C, and is a more modern variant of C.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-04-2009, 12:17 PM   #5
Jaxom's & Imriel's Dad
 
Kennedy's Avatar
 
Join Date: Aug 2006
Location: Alabama
Posts: 801
On the other hand, however, C++ is still very bloated and slow by comparison. So, if you desire to go into embedded work, I would recommend C. And, BTW, C is more powerful than C++ and is the modern language of choice (in certain circles).

I guess the point here is that it is asinine to say "C is better than C++" or "C++ is better than C" as each has a place in the world. No one language is complete enough to handle EVERY task easily (though almost any language could handle any task -- just may not be tooled for it).
Kennedy is offline   Reply With Quote
Old 11-04-2009, 12:19 PM   #6
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 2,845
I can already see where this thread is going. Another C vs C++ debate incoming...
__________________
bit∙hub [bit-huhb] n. A source and destination for information.
bithub is offline   Reply With Quote
Old 11-04-2009, 12:59 PM   #7
Super Moderator
 
Join Date: Sep 2001
Posts: 4,680
Quote:
C# is primarily for Windows
More accurate to say the C# is primarily for the .NET platform, which is primarily for Windows. It was intended to be a multi-platform virtual platform, like Java, but in practice that hasn't really happened. Mono, exists, which is a Linux implementation of the .NET framework, and apparently it's improved greatly over the years. But unless I'm horribly out of the loop, it's certianly not mainstream.

In any case - comparing C# to C and C++ can get kind of silly, anyways. I also think that C and C++ are diverging more and more, it used to just be a matter of having classes and not having classes, but now they have two extremely different styles.
sean is offline   Reply With Quote
Old 11-04-2009, 01:03 PM   #8
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
Hehe. Yes, it always turns out that way, does it not?
But right now, I have some myths to bust. C is not better than C++. It is not faster than C++. Bloated is subjective. I would prefer to see it packed with a lot of useful features.
C++ is as fast as C, or faster. C is also just as fast as C++, or faster. It depends on how you use it and where.
And while you say is more a powerful language choice in certain circles, I find that to be a very bold statement. Sure, C is preferred in certain areas, but I do not know if I would exactly call it a modern language or more powerful. Usually there is a reason for C, but more powerful? I simply do not know.

But the point I was trying to make is this: C++ will usually get the work done faster than C, so it gets the upper hand (this may change depending on experience, of course, since it is subjective), so if there is a choice between learning C and C++, C++ is usually the better choice IMHO.
Of course, this also depends on where you want to write your code. Embedded systems usually only have C compilers. API is still C or Obj-C, but is still accessible from C++.

It is simply a choice of preference.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-04-2009, 01:13 PM   #9
Jaxom's & Imriel's Dad
 
Kennedy's Avatar
 
Join Date: Aug 2006
Location: Alabama
Posts: 801
Quote:
Originally Posted by Elysia View Post
Hehe. Yes, it always turns out that way, does it not?
But right now, I have some myths to bust. C is not better than C++. It is not faster than C++. Bloated is subjective. I would prefer to see it packed with a lot of useful features.
C++ is as fast as C, or faster. C is also just as fast as C++, or faster. It depends on how you use it and where.
And while you say is more a powerful language choice in certain circles, I find that to be a very bold statement. Sure, C is preferred in certain areas, but I do not know if I would exactly call it a modern language or more powerful. Usually there is a reason for C, but more powerful? I simply do not know.

But the point I was trying to make is this: C++ will usually get the work done faster than C, so it gets the upper hand (this may change depending on experience, of course, since it is subjective), so if there is a choice between learning C and C++, C++ is usually the better choice IMHO.
Of course, this also depends on where you want to write your code. Embedded systems usually only have C compilers. API is still C or Obj-C, but is still accessible from C++.

It is simply a choice of preference.
I guess the word irony is not in your lexicon, eh?
Kennedy is offline   Reply With Quote
Old 11-04-2009, 01:14 PM   #10
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
It is, if you make it obvious your post looks like irony, which it did not.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Old 11-04-2009, 01:25 PM   #11
Registered User
 
JOZZY& Wakko's Avatar
 
Join Date: Nov 2009
Posts: 25
So it basically comes down to the following questions.

1. Is there anything in C that you can not do in C++ or the other way around.

2. Would that one be best to learn then when you just want to write basic programs to begin with for a Windows or Linux platform?
JOZZY& Wakko is offline   Reply With Quote
Old 11-04-2009, 01:29 PM   #12
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
1) Yes, there is plenty that can be done in C++ that cannot be done in C (or at least not in any easy and fast way). I know there are a few things that C can do, but C++ cannot, such as variable-sized arrays, but aside from that, I am not really sure. Regardless, C++ has the big upper hand in this question.
2) I would argue yes. If you use the high constructs of C++, it is very easy to get started writing simple programs. I especially like Accelerated C++ which demonstrates such a way. Using C, it would take a while to get started due to its lower complexity. However, that complexity also exists in C++, but usually it can be abstracted using higher-level methods and/or functions.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.

Last edited by Elysia; 11-04-2009 at 02:13 PM.
Elysia is offline   Reply With Quote
Old 11-04-2009, 02:06 PM   #13
Registered User
 
Join Date: Jan 2005
Posts: 7,137
If you're just writing basic programs, I'd choose C++ and learn it as C++ (and not C with classes as many books/tutorials teach).

But either choice would be fine.
Daved is offline   Reply With Quote
Old 11-04-2009, 02:18 PM   #14
Registered User
 
JOZZY& Wakko's Avatar
 
Join Date: Nov 2009
Posts: 25
Quote:
Originally Posted by Daved View Post
If you're just writing basic programs, I'd choose C++ and learn it as C++ (and not C with classes as many books/tutorials teach).

But either choice would be fine.
Does it also not matter if you at a later stage want to build programs that use a network connection?
JOZZY& Wakko is offline   Reply With Quote
Old 11-04-2009, 02:28 PM   #15
Registered User
 
Join Date: Dec 2006
Posts: 1,780
Networking libraries are plenty for both.
cyberfish is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 09:20 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22