LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 09-12-2004, 08:07 PM   #1
jplev22
Member
 
Registered: Dec 2003
Location: Quebec City, Canada
Distribution: Slackware 12.1
Posts: 78

Rep: Reputation: 15
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
 
Old 09-12-2004, 08:38 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 47
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.
 
Old 09-12-2004, 09:00 PM   #3
irfanhab
Member
 
Registered: Jan 2004
Location: Pakistan
Distribution: OpenSuse 10.2, Slackware 11, Solaris 10
Posts: 415

Rep: Reputation: 34
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++
 
Old 09-12-2004, 09:48 PM   #4
R00ts
Member
 
Registered: Mar 2004
Location: Austin TX, USA
Distribution: Ubuntu 11.10, Fedora 16
Posts: 547

Rep: Reputation: 30
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.
 
Old 09-12-2004, 10:08 PM   #5
scorbett
Member
 
Registered: May 2002
Location: Canada
Distribution: Slackware, Mandriva, RedHat
Posts: 46

Rep: Reputation: 15
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.
 
Old 09-13-2004, 12:31 AM   #6
wegster
LQ Newbie
 
Registered: Aug 2003
Distribution: Gentoo, RedHat
Posts: 2

Rep: Reputation: 0
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
 
Old 09-13-2004, 07:19 AM   #7
jplev22
Member
 
Registered: Dec 2003
Location: Quebec City, Canada
Distribution: Slackware 12.1
Posts: 78

Original Poster
Rep: Reputation: 15
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?
 
Old 09-13-2004, 07:23 AM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
There's a few free books/guides on the net eg:
http://www.dwheeler.com/secure-progr...ams-HOWTO.html
http://publications.gbdirect.co.uk/c_book/
http://vergil.chemistry.gatech.edu/r...s/programming/
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
starting xprogram without starting X server. bruse Linux - Newbie 9 04-26-2005 08:05 PM
Terminal cmd for starting Matlab M-file editor without starting matlab fubzot Linux - Software 2 02-15-2005 07:49 AM
Won't Boot - Starting Printer Service - Starting CUPS jeansond Linux - Newbie 0 10-11-2004 07:39 PM
Starting apps after starting xfce?? gtgoku Slackware 2 08-21-2004 02:49 PM
starting kpppd w/ ximian or starting ximian w/ kde ergo_sum Linux - Newbie 8 12-02-2003 06:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration