Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-12-2004, 07:07 PM
|
#1
|
Member
Registered: Dec 2003
Location: New Brunswick, Canada
Distribution: Debian 10 Buster
Posts: 85
Rep:
|
Starting with C or C++?
I'm thinking getting into programming but I'm not sure what would be better to learn. I know C++ has some programming advantages that make it faster to program some same things in C. On the other hand, most linux programs seem to be still writen in C. Could it be confusing to learn C and then C++? Thanks
|
|
|
09-12-2004, 07:38 PM
|
#2
|
Senior Member
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313
Rep:
|
If you start with C++ its easier to learn, if you learn C first, then its hard to get into the right minset for C++, i.e. you learn tricks in C that aren't needed in C++, or in fact are very wrong.
The other way around also has its problems, but I think isn't as hard.
The main thing is what you want to program, and what you are going to use.
|
|
|
09-12-2004, 08:00 PM
|
#3
|
Member
Registered: Jan 2004
Location: Pakistan
Distribution: OpenSuse 10.2, Slackware 11, Solaris 10
Posts: 415
Rep:
|
Well it depends what you want to do
If you want to be a system programmer, a guy who works on the hardware drivers, kernel modules, and that sort of stuff, then you should definitely learn C, which is really good at this
but
If you want to look for application development, like developing KDE applications and so on, then you should look at C++
|
|
|
09-12-2004, 08:48 PM
|
#4
|
Member
Registered: Mar 2004
Location: Austin TX, USA
Distribution: Ubuntu 11.10, Fedora 16
Posts: 547
Rep:
|
I'd recommend learning both personally, for the reasons that irfanhab gave. But if I had to choose, I would start with C. Learning all the advanced C++ topics like templates, virtual functions, and operator overloading are just too much for someone who hasn't programmed before IMO, and makes the learning process longer and more frusterating. That's just my opinion though, you are free to disagree. 
|
|
|
09-12-2004, 09:08 PM
|
#5
|
Member
Registered: May 2002
Location: Canada
Distribution: Slackware, Mandriva, RedHat
Posts: 46
Rep:
|
I agree with R00ts: it's easier to learn C than C++, especially if it's your first language. Once you have a decent grasp on C, then you can approach OO programming (if you're still interested). Worked for me, anyway - Pascal and C were my first languages, years before I learned C++. Not sure how well that would have worked had I tried it the other way.
|
|
|
09-12-2004, 11:31 PM
|
#6
|
LQ Newbie
Registered: Aug 2003
Distribution: Gentoo, RedHat
Posts: 2
Rep:
|
Another comment for C or another reasonable language and then C++ (or Java). I used to teach programming, and can tell from first hand experience the number of people trying to 'avoid' C (or Pascal, it's been a while) and tried to go to C++.....had less than stellar results.
Generally, I agree with the last two few comments- if you're going to want to eventually 'hack' the Linux kernel, write device drivers or other system level programming, definitely C first as you'll primarily be writing to the kernel system calls, which are written in C. If you're going to want to write applications, then I _still_ suggest a non OOP language first, as you'll simply have a better idea of how things work down the road.
C++ is a somewhat over-complicated language, or can be (keywords with several context dependent meanings, multiple inheritance, and others), where C (or others) is simpler syntactically to learn, and will generally still be of use when/if you move to C++, Java, or ? It will also make you appreciate some of the 'niceties' C++ or Java buy you- writing a dozen lines of code versus 100, and give you a better grounding before jumping into the whole Object Oriented paradigm. I'm not 'thrilled' with Java personally, but I've seen a good number of 'Java programmers' that must have learned Java as their first language- that's not bad for some things, but they can have tendencies to having no _clue_ how the underlying OS works if Java doesn't 'hold their hand' (meaning provide an API for doing whatever task is at hand...)
Scott
|
|
|
09-13-2004, 06:19 AM
|
#7
|
Member
Registered: Dec 2003
Location: New Brunswick, Canada
Distribution: Debian 10 Buster
Posts: 85
Original Poster
Rep:
|
Thanks for the advices I think I learn C first. I was thinking of buying pratical C programming for O'Reilly. Good choice for learning?
|
|
|
09-13-2004, 06:23 AM
|
#8
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,434
|
|
|
|
All times are GMT -5. The time now is 10:02 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|