LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Do you really need to learn C before C++? (https://www.linuxquestions.org/questions/programming-9/do-you-really-need-to-learn-c-before-c-108384/)

coolman0stress 10-30-2003 08:42 PM

Quote:

Because of the mistakes made by the designers of C++ you cant learn C++ without learning a little C.
There is a reason why C++ is based on C.

moeminhtun 10-30-2003 09:10 PM

Yes. There's a reason. C++ was designed to be compatible with C to attract the C programmers to be able to migrate painlessly. This mainly for the marketing reason. But later, in software engineering point of view, this decision has been considered as a mistake. Ofcourse this is because software engineering only look at the technologies, not the business.

nibbler 10-31-2003 03:22 AM

I learned C, and so far I don't write big and complex programs, but I'm planning to learn C++ when I'll be doing more serious programs.

Robert0380 10-31-2003 05:53 AM

Quote:

Originally posted by moeminhtun
Because real C++ means "class" and "objects" and it's a real complex object oriented programming which is not really appropriate for the beginners.

Such statements shouldnt be made. I learned OO before anything else through Java. To say it isnt appropirate for beginners isn't right. Any language is appropriate for anybody no matter the level. I'm of the belief that concepts should come before any specifig language:

algorithms and data structures.


if you can get those down, you can branch to OO or Structural and be fine and still learn the other later. I myself learned concepts 1st, then OO in Java and later took a class that used C (it didnt teach C, we used C...had to figure out a lot on your own).

If you know your basic programming concepts and how to code. I dont think learning one style before the other will make a difference. If you start out with C, you'll know C but you wont know learn anything OO related. If you start out with C++, you'll pick up a lot of what is in C, but I don't think learning C 1st will make your learning of Object Oriented programming any faster just because you recognize the syntax.


So i guess based off my last few statements, if you need to learn both in a hurry start with C++. If you need ot know C++, start with C++. I see no advantage to starting with C.

ssobeht 10-31-2003 08:06 AM

Well, i still don't know neither C nor C++. I learned pascal when i was 11. I didn'r did so much on it but i used it to solve some genric maths problems and a few experiments and crazy things :D. I also learned then Basic an Visual Basic and a bit of Tcl/tk. Now (being 15) i'm starting to aproach Delphi (and spcially Kylix of course) to learn OOP. I got an introduction to it last year in a Java book i have witch i didn't finished(but i want to) and a bit in VB (but it's just Object based and it stinks). After learnig delphi i wanna try C++. I've got a book/tutorial around my bookcase.

well, this is the history of my life. I think that i'll learn C++ paralellaly to the C syntax.

itsjustme 11-01-2003 07:03 PM

Have you seen the Unix Haters Handbook?
http://web.mit.edu/~simsong/www/ugh.pdf

The UNIX-HATERS Handbook
Published by
IDG Books Worldwide, Inc.
An International Data Group Company
155 Bovet Road, Suite 310
San Mateo, CA 94402 Copyright é 1994
by IDG Books Worldwide.
All rights reserved.

"In an announcement that has stunned the computer industry, Ken Thompson, Dennis Ritchie, and Brian Kernighan admitted that the Unix operating system and C programming language created by them is an elaborate April Fools prank kept alive for more than 20 years." ... "Then Dennis and Brian worked on a truly warped version of Pascal, called A. When we found others were actually trying to create real programs with A, we quickly added additional cryptic features and evolved into B, BCPL, and finally C. We stopped when we got a clean compile on the following syntax:

for(;P("\n"),R=;P("|"))for(e=C;e=P("_"+(*u++/ 8)%2))P("|"+(*u/4)%2);

To think that modern programmers would try to use a language that allowed such a statement was beyond our comprehension! We actually thought of selling this to the Soviets to set their computer science progress back 20 or more years. Imagine our surprise when AT&T and other U.S. corporations actually began trying to use Unix and C! It has taken them 20 years to develop enough expertise to generate even marginally useful applications using this 1960s technological parody, but we are impressed with the tenacity (if not common sense) of the general Unix and C programmer. In any event, Brian, Dennis, and I have been working exclusively in Lisp on the Apple Macintosh for the past few years and feel really guilty about the chaos, confusion, and truly bad programming that has resulted from our silly prank so long ago."

maxsang 11-02-2003 02:58 PM

As Stroustrup and most C++ experts are at pains to point out,
C++ is a *general purpose* language. You can write procedural
code (similar to C), OO code, generic code, or some combination
of the three. If you learn C++ properly, you will learn a lot about
programming in general. Programming in C will then become a
matter of absorbing the idioms, since you'll already know the
syntax. C is a low level language, which is its main weakness
(as well as its main strength ;-) C++ is much more flexible, powerful
and (unfortunately) will take longer to learn. But it's worth it. I would
recommend these web sites for improving your C++. Good luck and
have fun!

http://mindview.net/Books/TICPP/ThinkingInCPP2e.html
http://www.parashift.com/c++-faq-lite/
http://www.gotw.ca/gotw/index.htm
http://mindprod.com/unmain.html
http://www.cuj.com/

shassouneh 11-28-2003 07:23 AM

I learned C++ before C. The HARDEST part about learning C after C++ is getting myself of object-oriented approaches and solutions to problems (imagine using object = (typecast *) malloc (sizeof(object)); versus object = new object();

titanium_geek 11-30-2003 01:52 PM

re UNIX hater's handbook:

LOL!!

A sign of the times, maybe? this year (2003-04) AP computer science exam is based on Java, not C++.
Therefore; am learning Java.

to ssobeht: if you're in a school that does AP exams/courses.. do Java. (there are two exams, do one each of the last two years of HighSchool. #1 11th grade, #2 12th grade)
I'm 16, by the way.

Oh: and what is C#?

titanium_geek

shassouneh 11-30-2003 02:00 PM

C# is a language created by Microsoft as part of their .net initiative. It performs better than C# and it has all the nice OOP capabilities of C++ and Java and it allows the use of pointers (in an unsafe context).

I still don't agree that Java should be the quote=unquote "standard". Java has a lot of down falls, and it would be devastating to see such a slow redundant language become the "standard" :(

titanium_geek 11-30-2003 02:09 PM

Quote:

Originally posted by shassouneh

I still don't agree that Java should be the quote=unquote "standard". Java has a lot of down falls, and it would be devastating to see such a slow redundant language become the "standard" :(

well.. for beginers: yes. I like Java a lot, nice to learn.
And: we are living in an increasingly internet based culture, (we're here, arn't we?) and Java is secure, and nice looking for that basis. I wouldn't write say: an OS in Java (imagine that: would be portable[?]) but i would write a bunch of other stuff in Java. It's portable to other architectures without a recompile.

Oh: what downfalls?

titanium_geek

shassouneh 11-30-2003 02:31 PM

downfalls like performance, performance, performance.

Also, there is this increasing trend of Java programmers to not know things that take place behind the scenes. It is my firm beleif that to be a good computer scientist u need to know how things work behind the scenes. Yes, this involves pointers, null, and lots and lots of diagrams and small boxes, LOL.

Many java programmers don't really know what's goign on behind the scenes so they are ata a HUGE disadvantage,.

Also the way I look at application programming is, If I worked so hard on some code, then gosh darn it I want an EXE file! Yes, the file could rely on an architecture like .net (like a C# executable) but I least i get a small reward of a semi-independant .exe file

Anywho, back to the subjetc of downfalls of java

I cannot begin to list all the downfalls of java. Like I mentioned earlier I have MANY bones to pick with Java. But two of the downfalls that come to mind are performance (large one) and the fact that things written in jhava suffer twice (once because java execution is slow, and once because everything is built on top of a slow platform).

WindowsBurner 11-30-2003 02:44 PM

It really doesn't matter which one you learn first but you might want to look into learning C instead of C++.A lot of people tell me C sucks and C++ is best but I find C is better.. thats just my opinion... I like it becuase you get more control over your program.. as for me I started learning C++ first and then I switched to C.. man that was hard... I had to unlearn the stuff I learned in C++ then learn C.. oh well.... next language for me is : Assembler.

titanium_geek 12-03-2003 04:53 PM

I'm not saying "Learn only java!"
I'm just saying I like it. Guess I'll have my opinion, you'll have yours.
I'm going to learn C++ or C, sometime in the future.
I'm learning java now so I can get college credit.

woohoo! mega progress in java today!

titanium_geek

codedv 12-04-2003 09:35 AM

C first. It then makes C++ a doddle and theres no harm in knowing more than you need.


All times are GMT -5. The time now is 08:19 PM.