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?
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?
You should learn them both. Lots of common aspects between C and C++.
Mainframe assembler programmer by trade. C coder when I can.
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.
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.
While you people debate on what's silly and what's not, I got a couple of questions...
1) Is learning C, then C++, the best way to go ?
2) When you say learning them both is silly, do you mean learning both at the same time ?
3) When you say learning them both, do you mean learning both at the same time ?
Thanks!
I guess everyone will give their own answer, but based on watching this same debate here a bunch of times, my impression is that people are (mostly) presenting the way they learned as the way to learn.
A couple of things are clear:
- if you want to learn C++, you do not need to learn C first. Just start studying C++.
- if you want/need to program in both languages, you might as well study both of them. You could do that at the same time, or consecutively, according to your fancy.
- since C++ includes most C syntax (altho there are some small differences), once you have this basic syntax down, the difference between the two will be about how you use the syntax to accomplish a goal. Related to this is the use of common libraries, which differ.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Then should one then learn Assembly, then C, then C++ then ?
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).
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.
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.C# is primarily for Windows
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.
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.
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?