C or C++ which should I learn first

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

C or C++ which should I learn first

3,601 次查看
steve2
Contributor I
I've been doing this EE thing for 15 years now.  I did assembly language in the past (2 jobs and 8 years ago).  I want to get back into micro work.  It used to be that C was the thing to know.  Now I wonder if I would be better off learning C++.
 
What is the difference between these two?  When do you use C and when do you use C++?
 
Thanks!!
标签 (1)
0 项奖励
回复
4 回复数

854 次查看
elec
Contributor I
Hi steve, I am not a professional with Electronic or Programming.
What I want to share with you is that me too I wanted to learn C++ without knowing C programming so I asked many people their advice and all tell me that I would be good (I should start) to start with C first and then moving to C++; But it was not what I want ,I wanted to learn C++, so I start learning C++ and I see all books(or many) I had on hand always refered to C programming, The autor always supposed some time that you knowed C et he just went on. It was hard, I could not understand anything. that is my experience so I would like you to start with C first and then it would be easy for you to understand the C++, as alex and others said before, C++ is an extended C. Know that you do not need to be a guru first of C to migrate to C++; You just need the C's basic like arrays, pointers(be sure to well understand pointers because they are fundamentals in C and C++) and structures etc...
Best regards
Cyrille
0 项奖励
回复

854 次查看
alex_spotw
Contributor III
Hi:

Welcome!

C++ is a certainly a much more complete and advanced programming language than C. (C is a subset from C++). However, it is much more complex and probably harder to learn (unless you have experience in other Object-Oriented languages, like Java).Additionally, it could create larger executable code than C.

Another consideration is the availability of development tools. Usually, C++ compilers are much more expensive than C compilers.

Therefore, I would suggest to start learning C, and then moving to C++.

Regards,

Alex

Message Edited by alex_spotw on 2006-07-24 12:34 PM

0 项奖励
回复

854 次查看
steve2
Contributor I

Alex,

   thanks for the info on why to learn C.  I am reading "The C Programming Language" 2nd Ed.  I will soon fire up the Freescale demo unit I have and play around with that.  I will see if I can make a simple volt meter with LCD.  Then try to get an accelerometer from AD to measure incline.

0 项奖励
回复

854 次查看
rocco
Senior Contributor II
Hi, Steve:

In my opinion, which one to use boils down to the complexity of the problem you need to solve. I use C++ for some projects, C for others, and assembler for most.

The difference between the C and C++ is that the latter has Object-Oriented capabilities. If the problem you need to solve is complex enough to benefit from OOP constructs, then C++ might be your choice. If objects are of little use to your application, then C would be a better choice, as the added overhead of C++ can be a heavy burden on a microcontroller.

In any case, you should learn C first. As Alex pointed out, C++ is an extension to C.
0 项奖励
回复