Difference between C, C++ and C#?

neilofbodom

Member
Hi,

I really enjoy programming but so far I've only programmed in Pascal and in Java. Now I want to try something better...I do not know much about other languages except from those I learned...but what is the difference between C, C++ and C#??

Also, what would you recommend me learning? As I said, I only have knowledge in Pascal and Java. Should I go for C? Or shall I try something else?

Thanks in advance!

:)
 

Cromewell

Administrator
Staff member
C and C++ are pretty similar, C++ adds objects, virtual functions, operator overloading, multiple inheritance, templates, exception handling, etc. C# is more Java like.
 

neilofbodom

Member
C and C++ are pretty similar, C++ adds objects, virtual functions, operator overloading, multiple inheritance, templates, exception handling, etc. C# is more Java like.

Oh i see i see. Thanks, i'll have a go at C++ and i'll try C# later on. To be honest, i don't really like object oriented programming.

Thank you for the reply :)
 

Gary24

New Member
Hi,

C - an older programming language that is described as Hands-on. As the programmer you must tell the program to do everything. Also this language will let you do almost anything. It does not support object oriented code. Thus no classes.

C++ - an extension language of C. In C code ++ means increment 1. Thus C++ is better than C. It allows for highly controlled object oriented code. Once again a very hands on language that goes into MUCH detail.

C# - Full object oriented code resembling the style of C/C++ code. This is really closer to JAVA. C# is the latest version of the C style languages and is very good for developing web applications.

I hope your doubt is now solved. :)
 

S.T.A.R.S.

banned
C,C++ and C# are all good languages and EVERYTHING can be made in any of them if you know how.
I personally like C# the most because it's syntax is pretty good,but C and C++ are also great.

It's not the language that's the limit.It's the person's knowledge that's the limit ;)
 

neilofbodom

Member
Hi,

C - an older programming language that is described as Hands-on. As the programmer you must tell the program to do everything. Also this language will let you do almost anything. It does not support object oriented code. Thus no classes.

C++ - an extension language of C. In C code ++ means increment 1. Thus C++ is better than C. It allows for highly controlled object oriented code. Once again a very hands on language that goes into MUCH detail.

C# - Full object oriented code resembling the style of C/C++ code. This is really closer to JAVA. C# is the latest version of the C style languages and is very good for developing web applications.

I hope your doubt is now solved. :)

it's all clear to me now ;) thanks! I'll try C then, since it is not object oriented. :)
 

neilofbodom

Member
C,C++ and C# are all good languages and EVERYTHING can be made in any of them if you know how.
I personally like C# the most because it's syntax is pretty good,but C and C++ are also great.

It's not the language that's the limit.It's the person's knowledge that's the limit ;)

I definitely have a lot to learn, I have never tried C. Pascal was quite a simple language to learn but I found Java a bit harder. Object oriented kinda confuses me. I'll have a go at C ;)
 

S.T.A.R.S.

banned
C# is almost completely object oriented programming language.It's not that hard once you start understanding it's logic.
Why don't you like object oriented programming so much anyway lol?
 

TrainTrackHack

VIP Member
It's not the language that's the limit.It's the person's knowledge that's the limit
True only to an extent - it's going to be much harder to program a big enterprise application in just C rather than, say, a .NET language, Java or even just C++. Powerful languages let you do get more done efficiently with less effort, and there's a point where something you could do with a certain language couldn't be done in a more primitive/lower level language. And then there are languages that are better suited for some things than others... in real world with pointy haired bosses dictating the programmers' choice of language, the language can very well be the limit.

As for abject-oriented programming, if you want to learn programming seriously, object-oriented programming is pretty much a must. It's not particularly hard once you do get it, but I can see how it would be confusing since the example cases that I've come across in most tutorials, while great analogies, don't make a great effort to explain how it works in practice rather than just sweet theory, and when I was younger I was often left wondering why one would want a Vehcile which has Automobile and Quadbike as subclasses, the former of which has StationWagon and Ute but only the last two were of any use since all others were either abstract classes or interfaces.

EDIT: If you're learning programming just as a hobby or out of curiosity/for mucking about, you're alright without OO, but it's still worth looking at once you get better. Also, while C++ is object oriented, unlike some languages it makes OO programming "optional" - you're free to bang away at procedural code C style as much as you like and the language won't get in the way but it does have a lot bigger and powerful standard libraries and some other cool features, so I would recommend it over C. While some do teach C as a stepping stone to C++, knowing C to learn C++ isn't necessary at all.
 
Last edited:

HazzaHnoob

New Member
I've just started C, but its only a very small part of my course, so while the lecturer talks about it as a stepping stone to C++, we'll only ever use it embedded in labVIEW and in conjunction with Matlab in the labs next year.

I only get 6 weeks of it, but I think I'll try a project, probably using C++ over the summer...
 

neilofbodom

Member
C# is almost completely object oriented programming language.It's not that hard once you start understanding it's logic.
Why don't you like object oriented programming so much anyway lol?

It's not that I hate it; I don't feel comfortable using it and at the moment I don't really understand its purpose. I only programmed in Java for about a year or a bit less. I used to program in Pascal for 3 years before Java so I got really used to that type of language. Maybe that is why i am not that comfortable with Java yet.
 

neilofbodom

Member
As for abject-oriented programming, if you want to learn programming seriously, object-oriented programming is pretty much a must. It's not particularly hard once you do get it, but I can see how it would be confusing since the example cases that I've come across in most tutorials, while great analogies, don't make a great effort to explain how it works in practice rather than just sweet theory, and when I was younger I was often left wondering why one would want a Vehcile which has Automobile and Quadbike as subclasses, the former of which has StationWagon and Ute but only the last two were of any use since all others were either abstract classes or interfaces.

EDIT: If you're learning programming just as a hobby or out of curiosity/for mucking about, you're alright without OO, but it's still worth looking at once you get better. Also, while C++ is object oriented, unlike some languages it makes OO programming "optional" - you're free to bang away at procedural code C style as much as you like and the language won't get in the way but it does have a lot bigger and powerful standard libraries and some other cool features, so I would recommend it over C. While some do teach C as a stepping stone to C++, knowing C to learn C++ isn't necessary at all.

That is a reason why I don't get Object Oriented programming. Also, I am more familiar with Pascal since I had it for 3 years at school.

I am studying Java at college and we are expected to create a program for a project as part of our final exam in May. I am writing a music trivia quiz which is relatively easy to write. With Pascal, I also had a project where I wrote a hangman program which was quite easy to write. I don't see how hangman would be any simpler in an Object Oriented language though. I wanted to try creating hangman in Java but I had NO IDEA how lol.
 

S.T.A.R.S.

banned
Once you start understanding programming logic then all languages are a lot easier to learn.At least to me.It's just a different syntax and way things work.
People for example say C++ is hard.Well not really.If you know C# then it is also very easy to learn C++ too.It's all about logic and your effort.
 

TrainTrackHack

VIP Member
Once you start understanding programming logic then all languages are a lot easier to learn.
All similar languages, rather. C#, C++, Java all share similar syntax and language features (static typing yada yada), and all of those plus C, Pascal, .NET dialects and so on would fall under imperative programming languages (and other not mutually exclusive paradigms) which again share numerous similarities in the way they tackle problems. Some people have trouble correctly adjusting to even trivial differences like going from static to duck typing because they try apply logic that they used with a language they learned before (even though it might not work well with the new language), but once you start playing with languages that "defy the norm" (like functional programming languages), the understanding of programming logic you had with other languages no longer applies at all and can even get in the way.
 

HazzaHnoob

New Member
But surely the basic logic functions like if, else, or etc still apply in any language? As would the skills required to debug and the good habits like commenting on lines??

So from that respect, learning to program in any language should help with any future programming language someone chooses to learn...
 

TrainTrackHack

VIP Member
But surely the basic logic functions like if, else, or etc still apply in any language?
Actually, no. In Haskell, for example, the if statement is actually an expression (so any if block has to return a value), and constructs like for/while/repeat loops don't even exist (all looping is done by recursion). Haskell is one of the more exotic languages, though, but the point remains. While most basic logic works well in many of programming languages, once you get into higher-level stuff you'll find that one way of doing things is efficient in only a fairly small number of languages.

As would the skills required to debug and the good habits like commenting on lines??

So from that respect, learning to program in any language should help with any future programming language someone chooses to learn...
Mostly yes. Debugging an entirely different language has its differences, but mostly these kind of skills are perfectly transferable.
 

S.T.A.R.S.

banned
Haha good habits!
Good programming habits are the ones that fits YOU the best and not someone's else :p
I remember when I started.People kept telling me that I must comment my lines otherwise later when I continue working on a software that I will not know what all that code I wrote is for because I would forget and especially if I write many lines of code.
And that is not true actually.If you know programming very well then even reading the code written by you is JUST LIKE reading the comments written by you lol.Code tells you everything...absolutely everything.
Comments are like reminders and explanations of each code sections,but to me there is really no need for that since to me the self code is already a reminder and explanation lol :D So if you know the code well,why the hell would you explain something written by YOU which is already self explanatory :p

Unless if you make something and later someone else will continue working on that project.But even then I would not comment any of my code.Why would I make their life easier lol? Let them sweat! :D
If I sweat then they should sweat too! :D




Cheers!
 

SFR

Truth fears no questions
This thread got a little off topic but I think it is important to note that, at the very least, placing in-line comments is extremely important. It will not only save you but it will also helps others when looking back at code written months or years ago.

I've been a programmer for more than six years now and I find myself constantly thanking myself and past/present co-workers when code is properly documented.

When a customer calls up for the first time in years and asks for a simple change or calls up and asks for a complete redesign of their system, thousands of dollars in review and design time can be saved when code is properly documented.

They don't tell you this in college, but I've found that about 75% of my day is spent documenting my code through comments in the code and well as through detailed written design pages.

So... whatever language you decide to learn, if you decide you want to make a career out of it, make sure you learn to 'enjoy' documenting your code.
 
Top